Hacker Newsnew | past | comments | ask | show | jobs | submitlogin
On undoing, fixing, or removing commits in git (sethrobertson.github.io)
78 points by CoffeeOnWrite on June 4, 2015 | hide | past | favorite | 7 comments


On a similar note is this flowchart which walks you through recovering from various Git mistakes: http://justinhileman.info/article/git-pretty/


I came expecting another proclamation of global perishing of kittens, caused by relentless use of git rebase. Instead i came to find an excellent guide i can link to all my coworkers. This is a really pleasant surprise.


Thank you for this, it's excellent. Even after several years of using git, I still have to look up several of these things every single time I need to fix anything, I don't know why the commands don't stick in my head (just the generally non-intuitive syntax maybe?), this is exceptionally useful.


this is the biggest weak point of using git in my opinion. if you are not in the habit of using these undo/remove/fix operations in a regular basis, these commands slip away from you...

however, you can also look into this as a safety feature :) removing stuff is dangerous work in version control and thus, maybe, it's good that every time you have to do a dangerous thing, you need to refresh your memory by checking things. doctors and pilots started using check-lists that they go through before operations so that they don't do any mistakes and it seems to be decreasing the number of 'unforced-errors' so to speak... maybe this non-intuitive syntax also helps git in preventing committing simple errors...


If git's biggest weak point is not having to fix (most likely human) errors then we're pretty good off I'd say.


We use this guide often in the #git irc channel where Seth Robertson used to frequent.

It's a nice guide because sometimes people don't even know what they really want because terms like revert are overloaded.


I discovered this link a few weeks ago while writing an internal 'howto' wiki to help our developers move to git from svn and linked to it right away. Really well written and constructed article.




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

Search: