Git - How to diff the same file between two different commits on the same branch

De openkb
Aller à : Navigation, rechercher

Sommaire

Questions

On git, how could I compare the same file between two different commits (not contiguous) on the same branch (master for example)?

I m searching for a Compare feature like the one in VSS or TFS, is it possible in Git?

Answers

https://www.kernel.org/pub/software/scm/git/docs/git-diff.html https://www.kernel.org/pub/software/scm/git/docs/git-diff.html

git diff [--options] <commit> <commit> [--] [<path>...]

For instance, to see the difference for a file "main.c" between now and two commits back, here are three equivalent commands:

$ git diff HEAD^^ HEAD main.c
$ git diff HEAD^^..HEAD -- main.c
$ git diff HEAD~2 HEAD -- main.c

Source

License : cc by-sa 3.0

http://stackoverflow.com/questions/3338126/how-to-diff-the-same-file-between-two-different-commits-on-the-same-branch

Related

Outils personnels
Espaces de noms

Variantes
Actions
Navigation
Outils