Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

git log to return only the commits made to the master branch?

Tags:

git

I've done a bit of searching and found:

git log myBranchName 

as a possible solution. But what happens when my branch is the master branch? when I run:

git log master 

It seems to return everything commited to any branch. Based on what I've read, it lists all of the commits related to the master branch. Knowing that, how I can call up the commit history of the master branch only?

like image 822
Kris Anderson Avatar asked Apr 08 '13 09:04

Kris Anderson


People also ask

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.

What is git log -- Oneline?

Git Log OnelineThe oneline option is used to display the output as one commit per line. It also shows the output in brief like the first seven characters of the commit SHA and the commit message. It will be used as follows: $ git log --oneline.

How can I see only my commits?

You should use the --author flag to the git-log command. You could then just type: git mylog and see your commits only.

How do I limit a git log?

The most basic filtering option for git log is to limit the number of commits that are displayed. When you're only interested in the last few commits, this saves you the trouble of viewing all the commits in a page. You can limit git log 's output by including the - option.


1 Answers

I think this is what you want

git log --first-parent master 

To quote the manual

Follow only the first parent commit upon seeing a merge commit. This option can give a better overview when viewing the evolution of a particular topic branch, because merges into a topic branch tend to be only about adjusting to updated upstream from time to time, and this option allows you to ignore the individual commits brought in to your history by such a merge.

like image 124
parkydr Avatar answered Sep 22 '22 19:09

parkydr