git-diff

`git add --patch` with `--word-diff`

让人想犯罪 __ 提交于 2019-12-21 07:58:06
问题 git add --patch provides a great interface for reviewing unstaged changes and then staging only the ones that are wanted in the next commit. Great, except for one thing: there is no obvious way to choose which diff view to use. In particular, I would like to be able to configure git add --patch to present diffs to me the same way that git diff --word-diff does. How can I achieve that? (N.B. neither --word-diff nor --word-diff --color is exactly the same as --color-words , and so this question

Use BeyondCompare to see difference between files in GIT

守給你的承諾、 提交于 2019-12-21 03:47:06
问题 Before I commit my changes, I want to see the difference using BeyondCompare in GIT. How can I configure BeyondCompare to see difference in my files. I looked at this link but it did not help. BeyondCompare is installed at this location in my system: C:\program files\Beyond Compare\BCompare.exe I ran following two commands: git config --global merge.tool bc git config --global mergetool.bc.path "C:\program files\Beyond Compare\BCompare.exe" I am using GIT on Windows 7. Thanks !! 回答1: This

Make git ignore modification date changes if the content of the file stays the same

放肆的年华 提交于 2019-12-20 18:53:31
问题 I have python scripts which generate and modify different xml-files. They work so that they open a file, create an ElementTree object based on it, try to modify object's content if necessary and than save those objects into origin files. The thing is that sometimes they don't change the content of the file even a bit. But file's modification date changes. Git, on the other hand, treats those file as "changed" because it notices that modification date has changed. Although it won't make diffs

Github Comparison View for 2 branches is incorrect?

血红的双手。 提交于 2019-12-20 09:50:24
问题 When I do a Github comparison view between master and another branch A , Github seems to be comparing the HEAD version of A with an older, non head version of master . I looked into it, and from what I can tell it sounds like Github is comparing branch A against a common ancestor of master . It's not actually comparing it to what's currently at the HEAD of master. Is there a way to diff the HEAD of master against the HEAD of Branch A in Github? If not, why not? This seems like a feature every

How to make git-diff and git log ignore new and deleted files?

天涯浪子 提交于 2019-12-20 08:09:08
问题 Sometimes there's a couple of changed files together with some new, deleted and/or renamed files. When doing git diff or git-log I'd like to omit them, so I can better spot the modifications. Actually, listing the names of the new and deleted files without their content would be best. For "old" renamed to "new" I'd like to optionally get the difference between "old" and "new". 回答1: The --diff-filter option works with both diff and log. I use --diff-filter=M a lot which restricts diff outputs

How can I do a three way graphical diff (not merge) with git?

寵の児 提交于 2019-12-20 06:14:15
问题 I have two branches in git that are similar and I want to manually pull those changes into a third branch that is quite different. Is it possible to do a three way graphical diff of those changes? Graphical diff of two branches is currently setup and working well with 'meld'. The following displays a graphical meld window as expected: git diff branch1 branch2 -- myfilename I tried to do the following, but I get the ASCII output of 'diff --cc'. git diff master branch1 branch2 -- myfilename Is

git diff for custom 2 files outside of any repository?

一世执手 提交于 2019-12-20 04:58:12
问题 I need git diff functionality for 2 files that I have outside of any repository. Is there a way to do it? Something like git diff --file1 /path/file1.txt --file2 /path/file2.txt If not, what may be an alternative solution? 回答1: The answer is right in the git diff documentation (though I admit it's easy to miss): git diff [<options>] --no-index [--] <path> <path> This form is to compare the given two paths on the filesystem. You can omit the --no-index option when running the command in a

How can I make git difftool to use gvim (gvimdiff)?

戏子无情 提交于 2019-12-20 03:28:09
问题 There seems to have been a change in git which makes it no longer work correctly with gvim as the diff tool. Specifically, I always used to use the gvim -geometry flag to maximize the window. Now, I end up with one of the windows blank (empty/zero line file). 回答1: OK, I found the answer. In order to work correctly, gvim must stay in the foreground and NOT fork a new process as usual. This is accomplished by using the "-f" or "--nofork" flag when starting gvim (or gvimdiff). I have now setup

How can I do case insensitive git diffing while also doing `git diff --color`?

孤者浪人 提交于 2019-12-19 05:19:38
问题 Is it possible to do a case insensitive git diff while also doing git diff --color-words ? Or do I need to use an external diff program while doing git diff --color-words ? ( note: if all you want is git diff case insensitive please go to this question How to perform case insensitive diff in Git ) 回答1: GIT_EXTERNAL_DIFF='diff -ipu "$2" "$5" #' git diff --ext-diff Or, in a nicer fashion without the # hack I used there: echo 'diff -ipu "$2" "$5"' >myscript; chmod a+x myscript; GIT_EXTERNAL_DIFF

How can I get content of a file from git index?

北慕城南 提交于 2019-12-18 11:08:42
问题 I have a file which has been already added to my local repository. I've modified it in the working tree, so git status shows me the file as modified. I would like to know what is the file content kept in the index before I stage the file. I can think of two ways of doing that: revert a patch generated by git diff, and apply it on the file in the working tree use git checkout-index, point to a temporary file and read the content from there Is there an easier way? 回答1: Use the : prefix to