git-diff

How to exclude files & directories from git diff --no-index

笑着哭i 提交于 2020-08-24 22:13:29
问题 How do I exclude files & directories from git diff --no-index ? For example, I want to show the differences between two directories project1 & project2 while ignoring their top-level .git directories ( project1/.git & project2/.git ) and all their .DS_Store files. 回答1: This is not exactly what you asked for, but it might give you the results you want: Add project2 as a remote of project1 and just git diff their HEAD s. git remote add other ../project2/.git git fetch other # Perform the diff

How to effectively review git submodule updates/rebases?

好久不见. 提交于 2020-06-09 19:42:11
问题 Our project uses a git submodule to pin one of our library dependencies. We regularly rebase the submodule to follow upstream changes, and we also have a set of commits on top of it that we cannot easily upstream. When somebody rebases the submodule, I only see this in the git diff of the parent repo: --- a/mysubmodule +++ b/mysubmodule @@ -1 +1 @@ -Subproject commit abc12345abc12345abc12345abcd12345abc1234 +Subproject commit efg67890efg67890efg67890efg67890efg67890 That is not very useful.

How can I get useful git diff of files saved by Libre Office Writer, with output in the command line?

青春壹個敷衍的年華 提交于 2020-05-28 04:54:26
问题 Default version of git diff for default .odt files is not showing what was changed Binary files i/filename.odt and w/filename.odt differ Is there a way to show what was really changed and keep file directly editable by Libre Office? 回答1: You could also use the flat xml format proposed by Libreoffice. The .fodt file format. See Libreoffice and version control or this answer that provides good links. From the link: If a document is saved as .fodt file it keeps the same data the .odt file would

Generate diff file of a specific commit in git

狂风中的少年 提交于 2020-05-10 04:07:10
问题 When the head is at a particular commit, I want to get a diff file so that I can reduce the head to one more level down and then try the testing functionality with and without applying the diff file. So is there a way to generate a diff file of a specific commit. Even though there is a way to change the head before and after commit, this method comes more handy. 回答1: See the changes of a specific commit. $ git diff <commit-sha> -p OR, $ git show --decorate <commit-sha> # see 'Author', 'Date'

why moved code is not colored in git diff?

倾然丶 夕夏残阳落幕 提交于 2020-05-10 03:21:05
问题 I install latest git and configure it to highlight moved code: $ git config diff.colormoved default Here is how it looks when code is moved (see 1->2) But 3-4 is not highlighted as moved code. Here is standalone changes: 回答1: See the documentation for --color-moved / colormoved in git-diff(1): --color-moved[=<mode>] Moved lines of code are colored differently. It can be changed by the diff.colorMoved configuration setting. The <mode> defaults to no if the option is not given and to zebra if

How to show relative paths in git diff command?

£可爱£侵袭症+ 提交于 2020-05-09 02:49:26
问题 It works in this way: MYPC /d/home/project/some/path (master) $ git diff --name-only --cached root.txt some/path/relative.txt I.e. it shows path from the GIT root, but I need relative paths from current directory. Expected result : $ git diff --name-only --cached --AND_SOME_OPTION ../../root.txt relative.txt In common sense, it should work like git status . P.S. The --relative option doesn't work because it will show files from this directory. In our example it will show only relative.txt . P

How do I make Git diff ignore version number changes?

喜夏-厌秋 提交于 2020-04-11 04:06:32
问题 Is there a way to remove version number change noise from a Git diff like this one? Specifically if a line only contains changes from one number to another can I set up Git diff to ignore it? 回答1: I think this can be achieved using git-diff --word-diff-regex=[^0-9] (see [^0-9] in action). For a more complex pattern you'll need a more complex regex but, except recursion, everything is possible with regex . From Git - git-diff --word-diff-regex documentation --word-diff-regex= Use < regex > to

How to improve git's diff highlighting?

喜你入骨 提交于 2020-04-04 08:50:51
问题 The output of git diff is optimized for code which tends to be one statement per line whereas text can (if authors like me are too lazy to use line breaks) cause diff output which is very hard to read and more of a "Where's Wally?" search than reading diff output whereas highlighting as done on GitLab's or GitHub's web frontend shows the difference immediately I'm aware that I'm comparing HTML and plain text (apples and oranges), however it should be possible to improve the git diff output by