What command is used to show changes between commits?
Posted by NickCrt
Last Updated: June 12, 2024
To show changes between commits in Git, you can use the git diff command. Here are a few common usages: 1. Show changes between the working directory and the last commit:
git diff
2. Show changes between the last commit and the staging area:
git diff --cached
3. Show changes between two specific commits:
git diff <commit1> <commit2>
Replace <commit1> and <commit2> with the respective commit hashes or references (e.g., branch names). 4. Show changes between a commit and its parent:
git diff <commit>
This will show the changes introduced by that particular commit. You can also use git log -p to see the commit history along with the differences introduced in each commit.