Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

In SVN, doing svn update will show a list of full paths with a status prefix:

$ svn update
M foo/bar
U another/bar
Revision 123

I need to get this update list to do some post-process work. After I have transferred the SVN repository to Git, I can't find a way to get the update list:

$ git pull
Updating 9607ca4..61584c3
 .gitignore                                         |    1 +
 uni/.gitignore                                     |    1 +
 uni/package/cooldeb/.gitignore                     |    1 +
 uni/package/cooldeb/                    |    2 +-
 uni/package/cooldeb/VERSION.av                     |   10 +-
 uni/package/cooldeb/cideb                          |   10 +-
 uni/package/cooldeb/                     |    2 +-
 uni/package/cooldeb/newdeb                         |   53 +++-
 ...update-and-deb-redist => update-and-deb-redist} |    5 +-
 uni/utils/2tree/{list2tree => 2tree}               |   12 +-
 uni/utils/2tree/ChangeLog                          |    4 +-
 uni/utils/2tree/                        |    2 +-

I can translate the Git pull status list to SVN's format:

M .gitignore
M uni/.gitignore
M uni/package/cooldeb/.gitignore
M uni/package/cooldeb/
M uni/package/cooldeb/VERSION.av
M uni/package/cooldeb/cideb
M uni/package/cooldeb/
M uni/package/cooldeb/newdeb
M ...update-and-deb-redist => update-and-deb-redist}
M uni/utils/2tree/{list2tree => 2tree}
M uni/utils/2tree/ChangeLog
M uni/utils/2tree/

However, some entries having long path names are abbreviated, such as uni/package/cooldeb/update-and-deb-redist is abbreviated to ...update-and-deb-redist.

I deem I can do with Git directly, maybe I can configure git pull's output in special format.

Any idea?


I've figured out a resolution to this:

First, save the last and current commit to variable PREV and NEXT:

$ PREV=`git show --format=format:%H --summary | head -1`
$ git pull
$ NEXT=`git show --format=format:%H --summary | head -1`

And then, compare the two commit using special format:

$ git diff --name-status $PREV $NEXT

This will give the output:

A       .gitignore
M       uni/.gitignore
A       uni/package/cooldeb/.gitignore
M       uni/package/cooldeb/
M       uni/package/cooldeb/VERSION.av
M       uni/package/cooldeb/cideb
M       uni/package/cooldeb/

Which is exactly the same as Subversion's.

Then, it's also easy to make it in preview mode:

$ PREV=`git show --format=format:%H --summary | head -1`
$ git stash
$ git pull
$ NEXT=`git show --format=format:%H --summary | head -1`
$ git diff --name-status $PREV $NEXT
$ git reset --hard $PREV
$ git stash pop
share|improve this question
Are you tying to "show what will be updated next pull" (title of your question or convert git pull to SVN's format? – Aleksandr Levchuk Jan 5 '11 at 23:44
I'm trying to show what will be updated next pull. The exactly path names is just enough. – Xiè Jìléi Jan 5 '11 at 23:46
Unfortunately, git pull -v doesn't get the full pathnames. – Xiè Jìléi Jan 5 '11 at 23:47
It's strange, actually git pull --no-commit do commit anyway. – Xiè Jìléi Jan 5 '11 at 23:58
I'm not sure why you need the full paths here - I understand your title question a bit differently, but if you already ran git pull then you can see the full path like this git log --stat --raw -n 1 - this will show the last commit files in raw format (to avoid opening less use git --no-pager ...) – Aleksandr Levchuk Jan 6 '11 at 0:25
up vote 3 down vote accepted

The first option of man git-pull is:


       With --no-commit perform the merge but pretend the merge failed and
       do not autocommit, to give the user a chance to inspect and further
       tweak the merge result before committing.

So use git pull --no-commit.

EDIT: Oops! This does not work. As 谢继雷 (question's author) pointed out git pull --no-commit will still commit. I'm using git version

If you don't what the changes that got pulled in, then there is a way to go back:

git branch bad-branch-1
git log                          # Find the point you want to restore to,
                                 # for example: 35da5f07ca2c5

git reset --hard 35da5f07ca2c5   # Rolls back history and files
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.