How can I diff a file, say pom.xml
, from the master branch to an arbitrary older version in Git?
Git – How to diff one file to an arbitrary version in Git
diff()gitgit-diff
Related Topic
- Git: How to force “git pull” to overwrite local files
- Git – How to make Git “forget” about a file that was tracked, but is now in .gitignore
- Git – Move the most recent commit(s) to a new branch with Git
- Git – How to check out a remote Git branch
- Git – How to delete a Git branch locally and remotely
- Git – How to push a new local branch to a remote Git repository and track it too
- Git – How to get the current branch name in Git
- Git – How to rename a local Git branch
Best Answer
You can do:
... to compare your current
pom.xml
to the one frommaster
20 revisions ago through the first parent. You can replacemaster~20
, of course, with the object name (SHA1sum) of a commit or any of the many other ways of specifying a revision.Note that this is actually comparing the old
pom.xml
to the version in your working tree, not the version committed inmaster
. If you want that, then you can do the following instead: