tags:

views:

109

answers:

2

I want to see a list of all changes the next push would do. git status seems to know that I've made local commits... how do I have it show me what those are? What I've been doing is something like this:

% git status
# On branch master
# Your branch is ahead of 'origin/master' by 7 commits.
...

Okay, it said 7 commits. So then I do

% git diff --name-status HEAD~7
M       bin/bench
M       scala/001/02.scala
M       scala/007/01.scala
A       scala/010/01.scala
A       scala/016/01.scala
A       scala/020/01.scala

Is there a more concise way to do this? I'm used to svn where "svn diff" would essentially do this, because there's no notion of staged/unstaged.

+3  A: 
git diff --name-status origin/master

Note that you can also define an alias in your git configuration file, such as the "newmaster" one:

git config alias.newmaster "diff --name-status origin/master"

Once this is done, you can use

git newmaster

to get what you want.

Samuel Tardieu
Thanks. I think I was having syntax problems with this. I was doing origin.master and origin master, but not /. And it looks like I'd do a git fetch origin to get it all ready for this diffing?
trenton
You might also want to do a git fetch first, in case your local copy of origin/master is out of date.
Neall
A: 

Isn't that what 'git cherry' is for ?

I have a shell alias 'push?':

$ type push? 
push? is aliased to `git cherry -v origin/master'

That doesn't give you the exact changes made but your good commit messages should tell you enough.

Stefan Näwe