git-diff

Differences for a certain folder between git branches [duplicate]

◇◆丶佛笑我妖孽 提交于 2019-11-29 20:13:38
This question already has an answer here: How do I git diff on a certain directory 4 answers As in the title, I want to have a diff file for a certain folder between the master branch and a branch I have created. You can use git diff master..yourbranch path/to/folder git diff compares trees (as in hierarchies of source files at two different points in time), so it can't extract the changes done by a certain author. If you want to see what changes a user committed, then you need git log . Does this solve your need? git log --author=jdoe oldbranch..newbranch -p -- path/to/subdirectory >

Is git's implementation of the patience diff algorithm correct?

拜拜、爱过 提交于 2019-11-29 19:33:20
问题 This question on Stackoverflow seemed to be a good candidate for the application of the patience diff algorithm. However, while testing my potential answer, I found that git diff --patience doesn't work up to my expectations (and, in this case, is no different from the default diff algorithm): $ cat a /** * Function foo description. */ function foo() {} /** * Function bar description. */ function bar() {} $ cat b /** * Function bar description. */ function bar() {} $ git diff --no-index -

What are the differences between these git diff commands?

人盡茶涼 提交于 2019-11-29 18:47:29
What are the differences between the following git commands? git diff HEAD git diff HEAD^ git diff --cached or the synonym git diff --staged git diff Amber git diff HEAD - Shows what has changed since the last commit. git diff HEAD^ - Shows what has changed since the commit before the latest commit. git diff --cached - Show what has been added to the index via git add but not yet committed. git diff - Show what has changed but hasn't been added to the index yet via git add . It looks like this: Working Directory <----+--------+------+ | | | | | | | | V | | | "git add" | | | | diff | | | | | |

How to view file diff in git before commit

假装没事ソ 提交于 2019-11-29 18:32:47
This often happens to me: I'm working on a couple related changes at the same time over the course of a day or two, and when it's time to commit, I end up forgetting what changed in a specific file. (This is just a personal git repo, so I'm ok with having more than one update in a commit.) Is there any way to preview the changes between my local file, which is about to be checked in, and the last commit for that file? Something like: git diff --changed /myfile.txt And it would print out something like: line 23 (last commit): var = 2+2 (current): var = myfunction() + 2 line 149 (last commit):

How to exit git log or git diff [duplicate]

橙三吉。 提交于 2019-11-29 18:31:08
This question already has an answer here: How to exit a 'git status' list in a terminal? 14 answers I'm trying to learn Git with the help of Git Immersion . There's one thing that frustrates me whenever I use git log or git diff : I can't figure out what to do next when I encounter this (END) word. I can't type any commands, and I end up closing the current Bash window and open another. How do I type in the next command that I want to use? Fred Foo You're in the less program, which makes the output of git log scrollable. Type q to exit this screen. Type h to get help. If you don't want to read

git diff --stat exclude certain files

风流意气都作罢 提交于 2019-11-29 17:02:33
问题 Trying to adapt the answers from Want to exclude file from "git diff" for the --stat flag and failing - the accepted answer (create a driver) seems unix only (redirect to /bin/true, whatever this means) plus it creates a driver and assigns it to the file kind of permanently, while I am looking for a switch to temporarily disable the diff for a file (or rather some files). The scripting solution: git diff `git status -s |grep -v ^\ D |grep -v file/to/exclude.txt |cut -b4-` actually calls git

Git diff - two disjoint revision ranges

假如想象 提交于 2019-11-29 12:40:57
I would like to select precisely some disjoint commits using the git diff command. Here is an example. The commits are disposed on a one-branch tree, starting with A (the oldest commit), and ending with Z (the most recent commit): A | B | C | D | ... | Y | Z I would like to select two ranges of commits, B-D and O-Q (included), and use them with git diff . This can be made with two commands: git diff B^..D git diff O^..Q Is it possible to do it using only one git diff command , in order to have only one output? Just imagine that O reverts D, it is helpful not to have O and D described

What is the diff version git use? diff2 or diff3?

匆匆过客 提交于 2019-11-29 12:40:57
Does anyone has clue which is the diff version used by git? This article for example explain in details the diff algorithm for dummies but whats is the actual algorithm which is used? For general knowledge here specs for diff2 & diff3 . diff2 : http://www.xmailserver.org/diff2.pdf diff3 : http://www.cis.upenn.edu/~bcpierce/papers/diff3-short.pdf I know you can configure git to use diff2 or diff3 git config --global merge.conflictstyle diff3 You seem to be confusing 3 different things The unix command line tool diff3 provided by GNU diffutils The output format of the diff that git provides (in

is it possible to add a comment to a diff file (unified)?

泄露秘密 提交于 2019-11-29 10:42:20
问题 I wonder if it's possible to add a certain amount of unparsed content to a diff file (unified) that is ignored as a comment. One good use of this would be having git diffs augmented with important information such as from which branch is that diff from (especially when using the --full-index option, which merely displays the blob references). 回答1: The unified diff starts with two line header: --- from-file from-file-modification-time +++ to-file to-file-modification-time Anything before this

Git Diff Indent/Pretty Print/Beautify Before Diff

烂漫一生 提交于 2019-11-29 10:12:56
Is there a way to make Git indent /beautify/pretty print two versions of C++ source files before diffing them? I don't want Git to show me the myriads of changes introduced after someone auto-formatted the code. Example usage: I hit git difftool --indent-before-diffing path/to/file and get the changes after both the original version of path/to/file and the modified version of path/to/file have been indented. If you can find an application that does the indenting for you, you could use the method described here for odt files: Add the following line to your .gitattributes file: *.odt diff=odt