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.

22

u/rwilcox Jun 19 '14

Any halfway competent developer should be able to master git in a couple of weeks

I disagree. I've been using Git every day for 6 years now and I've found Git's learning curve to be like a rollercoaster loop-de-loop: you're doing OK, then suddenly you need to do something that makes you go WTF so much you feel like you know less than you did 6 months ago.

git add, git commit, git push, basic branch workflow, sure. Mastering Git? I'd say years.

Quick how do you find the name of the branches the current commit is on? Push the current branch to the server but name it something different? Tell me about git push --force. What does git fetch do? What's in your global core.excludesfile file?

(Seriously, the number of developers that don't even know about Git's global ignore options is staggering. (I should never see .DS_Store files in my Git repo, but what do I see all the fracking time? .DS_Store files... Yes, thanks OS X, but still....))

3

u/[deleted] Jun 19 '14

Do you ever memorize all the functions and their arguments in the standard library of your language?! If you think you have to; you're doing it wrong.

To answer your questions, and this is off the top of my head:

Quick how do you find the name of the branches the current commit is on?

I don't. I always have the name of the branch printed as part of my bash prompt. I think git branch puts a start next to the current branch name.

Push the current branch to the server but name it something different?

git push remote_name local_branch_name:remote_branch_name

Tell me about git push --force.

Push the branch after rebasing. Basically force the push even though it would change the history for the branch.

What does git fetch do?

Download the data from the remote without merging any remote branch to your local branch.

What's in your global core.excludesfile file?

I don't know :)

6

u/Peaker Jun 19 '14

I always have the name of the branch printed as part of my bash prompt

I think he means something more like:

git branch --contains HEAD

git push remote_name local_branch_name:remote_branch_name

It's not really "local_branch_name" but "local_refspec", which confusingly, must be a branch name iff the remote branch name does not currently exist.

Push the branch after rebasing

Not after rebasing -- but whenever it's not a fast-forward in general. i.e: You can push it back a few commits, or after commit --amend, etc.

Download the data from the remote

Importantly, update the remote's tracking branches.