Thursday, 27 December 2018

GIT: Viewing changes with git diff and git show

18.1. See the differences introduced by a commit

To see the changes introduced by a commit use the following command.
git show <commit_id>

18.2. See the difference between two commits

To see the differences introduced between two commits you use the git diff command specifying the commits. For example, the following command shows the differences introduced in the last commit.
# directly between two commits
git diff HEAD~1 HEAD

# using commit ranges
git diff  HEAD~1..HEAD

18.3. See the files changed by a commit

To see the files which have been changed in a commit use the git diff-tree command. The name-only tells the command to show only the names of the files.
git diff-tree --name-only -r <commit_id>

0 comments:

Post a Comment