Intellipaat Back

Explore Courses Blog Tutorials Interview Questions
+1 vote
2 views
in DevOps and Agile by (19.4k points)

I have a local branch tracking the remote/master branch. After running git-pull and git-log, the log will show all commits in the remote-tracking branch as well as the current branch. However, because there were so many changes made to the remote branch, I need to see just the commits made to the current local branch.

What would be the Git command to use to only show commits for a specific branch?

Notes:

Configuration information:

[branch "my-branch"]

  remote = origin

  merge = refs/heads/master

2 Answers

0 votes
by (27.5k points)

Case 1: If your branch was created from the master, then while being in the branch perform the following command: 

$ git cherry -v master

Alternatively you can use:  

$ git log master..

Case 2: If you are not in the branch, then you can add the branch name to the "git log" command as shown below:

$ git log master..branchname

Note: If your branch was created from the origin/master, then mention origin/master instead of master.

0 votes
by (2.8k points)

To view the details of a branch, we use a command ‘git-log’ but if you want to see a specific branch :

Git log <branch-name>

31k questions

32.8k answers

501 comments

693 users

Browse Categories

...