Is there a way to see what would be pushed if I did a git push
command?
What I\'m picturing is something like the \"Files Changed\" tab of Github\'s \"p
One way to compare your local version before pushing it on the remote repo (kind of push in dry-run):
Use TortoiseGit:
Right click on the root folder project > TortoiseGit > Diff with previous version >
for Version 2 choose refs/remotes/origin/master
Try git diff origin/master..master
(assuming that origin/master
is your upstream). Unlike git push --dry-run
, this still works even if you don't have write permission to the upstream.
You can list the commits by:
git cherry -v
And then compare with the following command where the number of ^ equals to the number of commits (in the example its 2 commits):
git diff HEAD^^
git push --dry-run
git diff --stat HEAD remote/branch
If you are using Mac OS X, I would recommend you get Tower, it's a wonderful program that has made dealing with Git a pleasure for me. I now longer have to remember terminal commands and it offers a great GUI to view, track and solve differences in files.
And no, I'm not affiliated with them, I just use their software and really like it.
http://www.git-tower.com/
There is always dry-run:
git push --dry-run
It will do everything except for the actually sending of the data.
If you want a more graphical view you have a bunch of options.
Tig and the gitk script that come with git both display the current branch of your local copy and the branch of the remote or origin.
So any commits you make that are after the origin are the commits that will be pushed.
Open gitk from shell while in the branch you want to push by typing gitk&
, then to see the difference between what is on the remote and what you are about to push to the remote, select your local unpushed commit and right-click on the remote and choose "Diff this -> selected":