How to show "new" commits in git

I do

git pull 

to get new commits from the remote and merge them with my local branch.

How can I list the commits that “just entered”?

+4
source share
7 answers

If you are only interested in a specific branch (for example, master ), you can take the line at the output of git fetch that has this branch name:

 6ec1a9c..91f6e69 master -> origin/master 

and use it to build the git log command

 git log --graph --decorate 6ec1a9c..91f6e69 

Two periods mean "all fixations that are in the second commit (start / master), but not in the first (lead)", which is what you are looking for.

+1
source

You can use this:

 git log @{1}.. 

This is the same as

 git log currentbranch@ {1}..currentbranch 

where the designation @{1} means "commit the branch indicated immediately before its last update."

This shows that exactly those commits that merged.

+9
source

If you do git pull , it automatically merges commits; You cannot look only at new ones, but git log will provide you with a list of all commits.

If you just fetch ed commits, you can list them before merging, but I think it might be a little pointless.

Change A quick glance at the Internet seems to tell me that git log -p ..FETCH_HEAD will display the extracted, but not related transactions, as a fun fact if you ever need to see only your obligations.

Another : the ellotheth link in its comment seems to have a solution that even works with pull. It seems like git diff being used, but maybe git log ORIG_HEAD.. or would that work too?

... However, using fetch and merge instead of pull can be smart, especially if you assume that you don’t necessarily want to merge all commits or all at once.

+3
source

I think,

 git log --topo-order 

must work.

It is supposed to show journal entries in the order they are received in the current branch - not in chronological order.

+2
source

First call to git fetch Then:

 git log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr)%Creset' --abbrev-commit --date=relative master..origin/master 

It will look something like this:

 * d3e3a17 - (origin/master, origin/HEAD) Fix test (3 minutes ago) * a065a9c - Fix exec count (4 minutes ago) 

Related: How to see commit differences between branches in git?

+1
source

I would put you off until

git help log

to see options that may help your case. Perhaps you need the --first-parent option?

I personally do this a lot:

git log -n 5 --oneline

0
source

it

 git log 

you are looking for

doc about git log

-1
source

All Articles