Monday, March 25, 2013
rewriting history 2
Continuing from my last post:
I've discovered how to get back to an old commit. I was at chapter 16 and that's what I did:
git checkout chapter_14_SHA1_id
Took me back to chapter 14 again. After working through chapters 14 and 15 for a second time, I commited the code just before chapter 16. To make my HEAD revision point to this last commit, I did:
git reset chapter_16_SHA1_id
I re-coded chapters 14 and 15, and went from chapter 16 on. The first chapter 14 and 15 commits went to hell, but that's ok for now.
And I also found a way to correct the last commit, which is great if we forget do add a file or something like that. After adding the files as usual, that will do the trick:
git commit --amend
Awesome! =)
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment