git: how to see changes the next push will send
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/0开发者_如何学Python2.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.
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.
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.
This will list all the commits that exist in your branch but not in origin/master
git log origin/master..
精彩评论