3 ms·
> git rebase -i Very useful!
by naggie 12y ago
> git rebase -i
Very useful!
- qzw 12y agoYes, but watch out if you've already pushed to remote branches or even done merge/rebase with other local branches. You're rewriting history.
- Zikes 12y agoI 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.
- regularjack 12y agoIf you want to alter the most recent commit, you can 'git commit --amend', no need to rebase. http://git-scm.com/book/en/v2/Git-Basics-Undoing-Things http://git-scm.com/book/en/v2/Git-Basics-Undoing-Things
- lentil 12y agoFor 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.
- fennecfoxen 12y agothat flows naturally into git reflog -- to get you out of a botched rebase with git reset :P