r/programming • • Jun 19 '14

Reinventing GIT interface

http://tonsky.me/blog/reinventing-git-interface/
221 Upvotes

325 comments sorted by

View all comments

Show parent comments

4

u/[deleted] Jun 19 '14 edited Jun 19 '14

What you want is the differences between the local and remote branch

No, what I want is to see what I haven't pushed yet. In all branches. git log <remote>..<local> doesn't allow me to do that. Don't tell me that I want something different. This isn't a matter of having the wrong view. Local changes may exist that I forgot about because git let's you work on so many things at same time with ease. I need to know what local commits I've made so that I can put them in a remote location so that when my house burns down I won't lose all my work. I need to know that I can safely rm -rf a clone without losing work.

Currently, the only way to do that is to do an actual git push, and then still it's not garantueed to push everything I've committed locally .

-2

u/yawaramin Jun 20 '14

... what I want is to see what I haven't pushed yet....

Yes, and you do that by viewing the difference between the local and the remote branch. We're not telling you things here just for the fun of it; we're telling you what steps to take to achieve your goal in git.

Anyway. One of the most regularly-aliased commands in git is something like:

git log --graph --abbrev-commit --decorate --all --pretty=oneline

That shows you all your commits and their dependency relationships to each other. In other words, it shows you a nice visual of your entire repo history. This includes which commits your remotes have, and which commits your local repo has. You can quickly scan this to know exactly what you haven't pushed yet. But as /u/Peaker said, be sure to run git fetch <remote> first to let git know exactly which commits are where (local vs remote).