r/programming • • Jun 19 '14

Reinventing GIT interface

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

325 comments sorted by

View all comments

44

u/[deleted] Jun 19 '14

I guess I'm alone in finding git not that hard to use. My only issue is git isn't pretty and to that end I have a few scripts to give me prettier logs (like most people have) and prettier branch summaries (my macro displays all branches, their latest commit id and dates).

Beyond that I manipulate my tree with straight up git commands.

Any halfway competent developer should be able to master git in a couple of weeks let alone be able to write their own version of git given a couple of full time weeks to work in.

0

u/[deleted] Jun 19 '14

[deleted]

10

u/[deleted] Jun 19 '14

If that's all you do with git, than you're very far from any kind of "mastery" over git.

Tell me how to do this simple thing: View what hasn't been pushed yet.

The internet is full of answers to that question, and none of them actually work. And that's what makes git difficult.

I work with git all day, and the simple things are simple. But many other things that should be simple, aren't.

0

u/[deleted] Jun 19 '14

[deleted]

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).