Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

git: how to see changes the next push will send

Tags:

git

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.

like image 631
Trenton Avatar asked Oct 31 '09 01:10

Trenton


People also ask

How do you check which commits will be pushed?

In Git, we can use git show commit_id --name-only to list all the committed files that are going to push to the remote repository.


1 Answers

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.

like image 76
Samuel Tardieu Avatar answered Oct 21 '22 15:10

Samuel Tardieu