How to compare different version in Git. Let's assume my file got 10 version span 开发者_如何学JAVAacross 4 branch, how do i compare one version of file with another version of file ?
Based on git diff
:
git diff oneRef ANotherRef -- <path>
git diff [options] <commit> <commit> [--] [<path>…]
with path the path of your file within the repo.
You can specify the commits in a vast number of ways:
See "SPECIFYING REVISIONS" in git rev-parse for more.
See also the learngit site:
If you want to compare a file between two snapshots - two versions of your project - instead of comparing a snapshot and the contents of your working directory, you can specify both versions on the command line:
$ git diff v1.0 v1.1 -- afile
精彩评论