Reputation: 101
This is my full git log.
$ git log --oneline --decorate
77cbdda (HEAD -> master) file4
8afab80 file3
9a4cd72 file2
76c2efc (origin/master) file1
I want to get log from origin/master to HEAD. When I tried
$ git log --oneline --decorate origin/master..HEAD
I got log msg like below
77cbdda (HEAD -> master) file4
8afab80 file3
9a4cd72 file2
But what I want is like below.
77cbdda (HEAD -> master) file4
8afab80 file3
9a4cd72 file2
76c2efc (origin/master) file1
How can I get log message like that?
Upvotes: 2
Views: 2139
Reputation: 24174
origin/master..HEAD
means what exists in HEAD that is not in origin/master.
9a4cd72 (origin/master) file2
exists both HEAD and origin/master so, it is not in the list
$ git log --oneline --decorate origin/master~1..HEAD
This should work unless 76c2efc (origin/master)
is your very first commit. So, when trying origin/master~1
, you are getting error cause it does not exist in your working tree actually.
Upvotes: 1
Reputation: 22122
You can use
git log --oneline --decorate HEAD --not origin/master^@
The origin/master^@
will select all parents of origin/master
commit whenever it one, zero or many. And --not
will exclude this commits (and its parents) from listing.
Note: you need to exclude all the parents commits, because if you exclude only mainline parent origin/master~1
, then commits from all merged branches will got listed in case origin/master
is merge commit.
Upvotes: 0
Reputation: 101
I've got the reason why I got error when I command
$ git log --oneline --decorate origin/master~1..HEAD
That's because origin/master was the first commit. If it was second commit or more, there is no error.
Thank Edmundo.
Upvotes: 0