I am using git
to track changes in configuration files of third-party application. At the first moment I did initial commit and then was fitting settings of the application gradually. Now I have final good settings and committed them into git
. I wish to see what I had changed.
How to accomplish this?
I did
git log --graph
or similar, but see all commits marked with long hexadecimal numbers. May I use them for git diff
?
You can run the git diff HEAD command to compare the both staged and unstaged changes with your last commit. You can also run the git diff <branch_name1> <branch_name2> command to compare the changes from the first branch with changes from the second branch.
If you just want to see the diff without committing, use git diff to see unstaged changes, git diff --cached to see changes staged for commit, or git diff HEAD to see both staged and unstaged changes in your working tree.
The git diff HEAD [filename] command allows you to compare the file version in your working directory with the file version last committed in your remote repository. The HEAD in the git command refers to the remote repository.
When viewing a combined diff, if the two files you're comparing have a line that's different from what they were merged into, you will see the ++ to represent: one line that was added does not appear in either file1 or file2.
You can use the following commands
Changes between head and index.
git diff --staged
Changes between head and working files.
git diff HEAD
Changes between two commits
git diff $commit $ commit
Also have a look to the following and use as per requirement:
git log tag..branch
git log HEAD~10..
git log -10
git log -10 master@{yesterday}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With