There is some open-source project where there are many commits, with a pouring system through pull-request .

How from the console to view the commit only from the master branch?

By default, the git log --oneline will give me all commites by the time they were created. Ie, the comits created in a pullrequest will be visible, but I need to see a graph from pullrequests so that it would be easier to switch between them to find bugs.

grep in the text of commits

    3 answers 3

    In the gita, there is no such thing as "commits only from the master branch". The commits do not store branch information.

    One could always follow the first parent for each merge (and many utilities build the “master branch” in this way) - but this heuristics often breaks.

      So you can see:

       git log --oneline --first-parent 

        I was always saved by this alias git:

         [alias] tree = log --graph --decorate --pretty=oneline --abbrev-commit 

        Put it in the ~/.gitconfig

        I use this:

         $ git tree * 506b39f (HEAD -> test) second at branch * 07c0503 first at branch * f00cb21 first 

        If I want to see all the commits that have been made in my branch, starting from the point where I split off from master I execute:

         git tree master..HEAD * 506b39f (HEAD -> test) second at branch * 07c0503 first at branch 

        here we see only 2 commits that were made in the test branch and we don’t see commits that were made in the master branch

        If you are in the test branch and want to see what has changed in master since you started development, then do (three points !!):

         $ git diff test...master diff --git a/test.txt b/test.txt index 8a1218a..eb095b3 100644 --- a/test.txt +++ b/test.txt @@ -1,5 +1,5 @@ -1 -2 +11 +22 3 4 5 

        And these changes were made by commits (two points !!):

         $ git tree test..master * 565b82a (master) thirt at master * 1e408a9 second at master 

        Changes in these 2 commits:

         $ git show 565b82a commit 565b82a6319eb1afa5258bed37b640ec9a782679 Author: Eugen Konkov Date: Mon Oct 24 20:36:39 2016 +0300 thirt at master diff --git a/test.txt b/test.txt index bcba89f..eb095b3 100644 --- a/test.txt +++ b/test.txt @@ -1,5 +1,5 @@ 11 -2 +22 3 4 5 $ git show 1e408a9 commit 1e408a975a52fe9f6c32bd6cd7916c4ac082fd85 Author: Eugen Konkov Date: Mon Oct 24 20:36:27 2016 +0300 second at master diff --git a/test.txt b/test.txt index 8a1218a..bcba89f 100644 --- a/test.txt +++ b/test.txt @@ -1,4 +1,4 @@ -1 +11 2 3 4 

        And, similarly, all the changes that you made in your test branch, when it was budded from master :

         $ git diff master...test diff --git a/test.txt b/test.txt index 8a1218a..ec28619 100644 --- a/test.txt +++ b/test.txt @@ -1,5 +1,5 @@ 1 2 3 -4 -5 +45 +56 

        or if you are already on the test branch, then you can write HEAD :

         $ git diff master...HEAD 
        • one
          Almost the same use. About three points interesting, did not know, thank you. - Nick Volynkin ♦
        • @NickVolynkin: maybe I already showed it somewhere. Here you can see about even more interesting settings. View the end starting somewhere from 1h 28 min. If interested, you can still look. - Eugen Konkov