git-diff

Git workflow for a single developer on a local repository

好久不见. 提交于 2019-12-31 10:49:15
问题 I'm trying to refine a personal git workflow to something a little easier to deal with. Here's some background of how I'm using git for purposes of this post: A single developer who is the only one working on the repository. A single copy of the repository that is stored on the local machine. Only two branches "dev" and "master". All work done on "dev". What I'm trying to accomplish is to get to the point where the only commits made to the "master" branch are working production versions based

Git: remove leading plus/minus from lines in diff

别来无恙 提交于 2019-12-29 11:45:24
问题 My question is rather simple, though I have had no luck finding an answer. I'd like to remove the leading plus/minus symbols from each line in git diff . Before you ask why I wish to do this, allow me to outline my reasons: Lines that are exactly 80 chars will overflow by a single character, which just looks plain awkward The coloring is enough for me to distinguish between additions/deletions I'd prefer to keep my Terminal's window width at 80 chars (as opposed to an arbitrary 81 chars) to

Unexpected result in git-diff

不想你离开。 提交于 2019-12-29 08:10:57
问题 Why I get this patch: @@ -129,8 +132,9 @@ sub _preprocess_message { sub _process_message { my ($self, $message) = @_; - my $method = ref($message) eq 'HASH' ? $message->{method} : undef; + my $time = [ gettimeofday ]; + my $method = ref($message) eq 'HASH' ? $message->{method} : undef; return $self->send_error(ERROR_REQUEST_INVALID) unless defined($method); When remove empty line after my $method = ... : @@ -129,6 +132,8 @@ sub _preprocess_message { sub _process_message { my ($self, $message)

New git diff compaction heuristic isn't working

孤人 提交于 2019-12-28 18:13:39
问题 Update This is solved now, thanks to @torek's answer I needed to have more lines above the new addition so that Git could move up the diff'ed block, and by that I mean: +a +b +c + +["foo", "bar", "baz"].map do |i| + i +end + ["foo", "bar", "baz"].map do |i| i.upcase end Note: I tried with a single line-break instead of a\nb\nc\n and it also worked as well Original Question... I'm using Git 2.9 on Mac OSX Here is a reduced test case: $ mkdir git-highlight && cd git-highlight $ touch foo.rb I

Git - How can I reliably query if any files in master have been updated, via a merge or commit, since a period of time?

梦想的初衷 提交于 2019-12-25 06:43:22
问题 There are number of questions which try to map the CVS ability of cvs diff -D "1 days ago" to git: Git - How can I list all files changed on the master branch between two times? How can I get the diff between all the commits that occurred between two dates with Git? But from my understanding from the comments in this question: Does copying the Git bare repo change the log? performing git diff --name-only master@{"5 day ago"} master is local to your machine and can not resolve issues with

how show the diff from my current working directory and my last commit?

▼魔方 西西 提交于 2019-12-23 12:07:43
问题 I'm using git and need included in the diff result untracked files. So what command I must execute to get all the difference between my current working directory and the HEAD, even part of the difference exist in the new file addition? 回答1: Um, git diff ? That's what it does, after all. Update: "Files that aren't in the staged area" doesn't mean "untracked files". Those are two, separate categories. A file or change becomes "staged" when you git add it. Untracked files are ones that aren't

Why does output differ under git diff vs. git diff --staged?

非 Y 不嫁゛ 提交于 2019-12-23 06:41:18
问题 Why do we need both of these? And in what circumstances does the output they give on the command line differ? Can you explain the differences between the two under different scenarios like adding files, staging, and modifying. So what are the staged and unstaged changes? 回答1: You are, I think, being misled. Git doesn't store changes at all. The whole thing seems very mysterious until you realize that Git just stores everything intact, but does so in a weird way. What Git stores permanently

Differences between 2 branches after merge: GIT

本小妞迷上赌 提交于 2019-12-23 03:47:27
问题 I am currently working on a second branch called NC12-changePassword . There have been changes made to master branch which handle decrypting of a string. I required these new changes to be able to implement a new feature on my branch so I merged the changes. I did a git pull and there were no conflicts. When I run git log it shows the merge commit. Also when I run git merge master it tells me everything is up to date. However my code is not working and when I run git diff NC12-changePassword

Git diff working incorrect - to many changes

∥☆過路亽.° 提交于 2019-12-23 02:34:51
问题 f1---f2 - short term branch "feature1" / \ h--h--h---h--h1--h2- - long term branch "hofix" / \ \ \ / \ \ \ m----m------m---m------m-- - long term branch "master" | | 1e1e1e 2f2f2f I merge branches with 2 commits difference (15 file changed totaly). And ran: $ git show --pretty="format:" --name-only 1e1e1e..2f2f2f I receive more than 42 000 file changed from my project. Why? Expected: i will show diff with f1,f2,h1,h2 commits P.S. May be because "Merge branch 'origin/0411-hotfix'" commit? 回答1:

How to default to side-by-side view in GitLab

杀马特。学长 韩版系。学妹 提交于 2019-12-22 01:54:01
问题 How can I make Side-by-side be the default diff for my GitLab installation or project or profile? 回答1: Update February 2016 The issue is now at issue CE 3071 and... was resolved by commit 9fdd605! A cookie now retain your diff view choice, with GitLab 8.5.0+. Original answer (February 2015) That doesn't seem to be possible right now, and can be voted up at the suggestion 7082397 Remember side-by-side diff choice Right now when I want to review code, I have to choose side-by-side diff each