Hacker News new | past | comments | ask | show | jobs | submit login
Git Tips (adit.io)
119 points by egonschiele on Aug 19, 2013 | hide | past | favorite | 22 comments



I miss doing these at http://gitready.com. For years now I've accepted suggestions but haven't written any up. If you submit a PR for a new post I'll gladly merge and publish it (after review!).

https://github.com/gitready/gitready


I don't mean to hijack this thread, but I just wanted to express my appreciation: I love git ready! It was truly invaluable to me when I was learning git, and still today, I always seek it out in git-related search results. Great work, and thank you!


For those that are curious how the autocorrect does its magic, here is the code https://github.com/git/git/blob/master/help.c#L293.

The most important part of the algorithm is the line "levenshtein(cmd, candidate, 0, 2, 1, 3) + 1;". This calculates the levenshtein distance between what you typed and valid commands, using different weights for different types of manipulations. In this case, 0 for swaps, 2 for substitutions, 1 for adds and 3 for deletes.


Not to be confused with https://www.gittip.com/ "Distributed Genius Grants"


This showterm stuff is cool, but I really don't think it's ready for prime time. Besides breaking browser navigation by filling up the history or something, all the terminals play simultaneously when I open the page, and once a terminal finishes none of the buttons work anymore, only the manual slider. This is in Chrome.


Warning: that tab completion script will be very slow if you have lots of branches.


If only I could get out of the habit of tab completion when using 'scp'...


I remember having this same problem once upon a time. I forget how I solved it...

This[0]?

[0]: http://serverfault.com/questions/385920/disable-networked-ta...


I use shared connections, that makes tab completion scp usable.

  Host *
   ControlMaster auto
   ControlPath /var/tmp/ssh_mux_%h_%p_%r
   ControlPersist 4h


Pimping out Git Log is my favorite git tip and goes well with this mix: http://www.jukie.net/bart/blog/pimping-out-git-log

This is the one thing I recommend to everyone and anyone that uses git from the command line.


Why is the browser history being filled up?


I think it's showterm. If you scrub the timeline the back-button-history will fill up with the page you're on (at least in Chrome).


Ugh, that's what it is :( I didn't see that and I hate websites that mess with your history...guess I'll switch off showterm for now :(



Because you are browsing too much and too fast :)


Wow thanks for that autocorrect tip.

It always annoyed me when I make a typo and git almost always knows what I meant but doesn't correct it for me.

It was all a git config away.

I'd be interested in more git config options. Anyone know where I can find a full list? A quick google shows me the basic user name, email, etc options which I already have.


The git-config man page[1] is probably the best resource. The list of options is in the configuration file section under 'Variables'.

[1]https://www.kernel.org/pub/software/scm/git/docs/git-config....


I'm still looking for something that will make git file completion as nice as hg's. That is, in hg when I type hg diff <first couple characters of a modified file path> it can complete it for me. Ditto for commit, merge, etc.


Zsh. Prezto¹ has this built in.

¹ https://github.com/sorin-ionescu/prezto


The trimWhitespace filter removes both leading and trailing whitespace. Ouch.


Fixed, thanks!


Great article.




Join us for AI Startup School this June 16-17 in San Francisco!

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: