Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I see the commit differences between branches in git?

I'm on branch-X and have added a couple more commits on top of it. I want to see all the differences between MASTER and the branch that I am on in terms of commits. I could just do a

git checkout master git log 

and then a

git checkout branch-X git log 

and visually diff these, but I'm hoping for an easier, less error-prone method.

like image 578
Avery Avatar asked Dec 20 '12 04:12

Avery


People also ask

How do I find the difference between two commits in git?

To see the changes between two commits, you can use git diff ID1.. ID2 , where ID1 and ID2 identify the two commits you're interested in, and the connector .. is a pair of dots. For example, git diff abc123.. def456 shows the differences between the commits abc123 and def456 , while git diff HEAD~1..

How do I see differences between branches in GitHub?

On the Github, go to the Source view of your project. You will see a link named 'Branch List'. Once the page opens you can see a list of all the remote branches. Hit on the Compare button in front of any of the available branches to see the difference between two branches.

How do you compare different commits?

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 my commit history?

`git log` command is used to view the commit history and display the necessary information of the git repository. This command displays the latest git commits information in chronological order, and the last commit will be displayed first.


1 Answers

You can easily do that with

git log master..branch-X 

That will show you commits that branch-X has but master doesn't.

like image 179
Pablo Fernandez heelhook Avatar answered Sep 27 '22 22:09

Pablo Fernandez heelhook