4 ms·
On undoing, fixing, or removing commits in git
- Mithaldu 11y agoI 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.
- joshschreuder 11y agoOn a similar note is this flowchart which walks you through recovering from various Git mistakes: http://justinhileman.info/article/git-pretty/ http://justinhileman.info/article/git-pretty/
- sidm83 11y agoI 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.
- _ikke_ 11y agoWe 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.
- RobertKerans 11y agoThank 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.
- vladtaltos 11y agothis 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...
- ntnn 11y agoIf git's biggest weak point is not having to fix (most likely human) errors then we're pretty good off I'd say.