Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Show all commits in a git branch since original branching point from master

I'm looking for a way to view all commits on active branch since branching point (and including it) and hopefully since branching from master.

For example situation like:

A-B-C-D (master)
   \
    E-F (branch A)

I want to get commits F, E and B while F is the HEAD.

And for

A-B-C-D   (master)
   \
    E-F   (branch B)
       \
        G (branch C)

I want to get commits G, F, E, B in case G is current HEAD. Displaying this information with --graph option would be also great.

For now I have come up with

git log master^..HEAD

But it seems to be displaying too much information (like commits from other branches). Thanks for your help!

like image 635
radious Avatar asked Nov 16 '13 07:11

radious


People also ask

How do you see all commits in a branch git?

On GitHub.com, you can access your project history by selecting the commit button from the code tab on your project. Locally, you can use git log . The git log command enables you to display a list of all of the commits on your current branch. By default, the git log command presents a lot of information all at once.

Which git command show all commits in the current branch 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.

How do I see commits in master branch?

To confirm, you can run git branch . The branch that you are on will be the one with a * next to it. Git checkout might fail with an error message, e.g. if it would overwrite modified files. Git branch should show you the current branch and git log master allows you to view commit logs without changing the branch.


1 Answers

From "How Do I run Git Log to see changes only for a specific branch?", this should be enough:

git log  --boundary master..
# or
git log  --boundary --no-merges master..

More concise representation:

git log --boundary --no-merges --pretty='%C(yellow)%h%d %Creset%an %Cgreen%ar:%Creset %s' --graph master..

(add --boundary, as torek comments, in order to include what 'B' commit which would otherwise be excluded from the git log result)

like image 162
VonC Avatar answered Oct 23 '22 09:10

VonC