Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to see git diff from very beginning to the HEAD?

Tags:

git

graph

diff

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?

like image 665
Dims Avatar asked Mar 09 '12 12:03

Dims


People also ask

How do I view 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.

How do I see diff before commit?

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.

What is git diff head?

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.

What does ++ mean in git diff?

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.


1 Answers

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}
like image 132
Bijendra Avatar answered Oct 13 '22 00:10

Bijendra