News for hackers. Stuff that matters.
Re:Git is an editor, and rebase is the backspace key by crazygringo on Thursday January 31, 2013 @12:33PM (#5146088)
I wish I could have both. Rebase to stick to single clean commit messages, but still preserve the history/order of modifications within that, even without the messages.

I might work on a project for a week, write some code, do an intermediate commit, realize it's not needed, delete it. Then when I finally merge into master (rebase), that code I wrote is forever gone. Which I think is fine, but two months later I realize I could actually use it. But there's no way to get at it, is there? Or am I missing something?

Re:Git is an editor, and rebase is the backspace key by base698 on Thursday January 31, 2013 @01:12PM (#5146339)
Or am I missing something?

That you can create arbitrary branches and keep them forever remotely or locally. If you think you'll need it branch off that point: git checkout -b branch_i_may_need then checkout the previous branch. a git log branch_i_may_need will always show the commit you needed at the top and git cherry-pick `git rev-parse branch_i_may_need` will cherry pick it into whatever branch you're on. That way you keep the commit and can still keep the remote repo clean.

Re:Git is an editor, and rebase is the backspace key by simcop2387 on Thursday January 31, 2013 @01:54PM (#5146603)
You can also avoid doing the two git checkouts by just doing "git branch branch_i_may_need" and you'll stay in your current one. I do that all the time, though i had no clue about git rev-parse. That's a great time saver.
Re:Git is an editor, and rebase is the backspace key by decklin on Thursday January 31, 2013 @01:35PM (#5146496)
FYI, since (at least, IIRC) 1.7.2 that rev-parse is not necessary. You can even do `git cherry-pick ..branch_i_may_need` for multiple commits.
Re:Git is an editor, and rebase is the backspace key by lotyrin on Thursday January 31, 2013 @01:14PM (#5146346)
He actually mentions this exact thing, but briefly. Keep your refs around. Branch to blah-wip, make whatever commits, then rebase and cleanup to blah. Maybe blah gets merged in, but blah-wip will still refer to whatever original history.