Live data from Hacker News

Git tips from the trenches

ochronus.com

41–47 of 47 posts

Re: Git tips from the trenches

#41
post #6

I liked this one: git blame -w Ignore the whitespace if a block was [un]indented, attribute to original author instead of person re-indenting due to control structure change around block.

The truth is that command-line blame is a pain in the ass. Blame is great for finding out where a piece of code comes from, but (especially on big projects with many contributors) there's a lot of small churn with code being moved around, slightly altered, etc… CLI blame requires an extensive danse of "blame to find out last change before $(rev:tip)" "log with patch to find out if it's the change I'm looking for" "ge…

tig's blame is great, cursor through the file to any line and hit B to jump the whole file back in time to the last previous commit that changed that line; repeat as needed.

Re: Git tips from the trenches

#43
post #32

"After a few years with git everyone has his own bag o' tricks..." So "everyone" (every developer, ever) is a "he"? I'm not here to bash the author, but remarks like this (whether or not they're intentional) really don't help make the field of software engineering, which is already quite the boy's club, any more accessible to non-male people.

Actually you're right. Nice heads up, of course I meant no harm, I fixed it. Just for the record I'm organizing a programming course for girls :)

Re: Git tips from the trenches

#46
post #6

I liked this one: git blame -w Ignore the whitespace if a block was [un]indented, attribute to original author instead of person re-indenting due to control structure change around block.

The truth is that command-line blame is a pain in the ass. Blame is great for finding out where a piece of code comes from, but (especially on big projects with many contributors) there's a lot of small churn with code being moved around, slightly altered, etc… CLI blame requires an extensive danse of "blame to find out last change before $(rev:tip)" "log with patch to find out if it's the change I'm looking for" "ge…

SmartGit/Hg has a great interactive blame display. You can hover over commits to see the commit message, click on them to go back, etc. If you put the focus on the "View commit" select, then you can use the up and down arrows to go through the commits. You can also select different previous commits for the comparison window. Very easy to use and flexible.

IntelliJ IDEA also has a pretty nice blame panel. It's not as full-featured as SmartGit, but it's right there in the editor for any file with a quick Alt-G-N.

I would definitely recommend trying out SmartGit.

Post reply on HN