Re:Ten Years of Git: An Interview with Linus Torvalds
by qzw on Monday April 06, 2015 @03:23PM
(#9330151)
Yes, but watch out if you've already pushed to remote branches or even done merge/rebase with other local branches. You're rewriting history.
[ Parent
| on HN ]
Re:Ten Years of Git: An Interview with Linus Torvalds
by Zikes on Monday April 06, 2015 @04:04PM
(#9330389)
I most often use it because I forgot to include a certain file in my most recent commit. I'll just commit that file then rebase -i to merge the two.
Re:Ten Years of Git: An Interview with Linus Torvalds
by regularjack on Monday April 06, 2015 @05:09PM
(#9330708)
If you want to alter the most recent commit, you can 'git commit --amend', no need to rebase.
Re:Ten Years of Git: An Interview with Linus Torvalds
by lentil on Monday April 06, 2015 @05:11PM
(#9330724)
For quick changes to the most recent commit, a handy alias to put in your ~/.gitconfig is:
fixup = commit --amend -C HEAD
That way you can stage whatever you forgot, and then do `git fixup` to update the latest commit with it. Saves a little bit of typing :)I do love `rebase -i` for anything more complicated though.