![]() It essentially speeds up the process that ZelluX's answer illustrates, and is especially handy when you have more than one commit you need to edit. Interactive rebase with -autosquash is something I frequently use when I need to fixup previous commits deeper in the history. ![]() If you'd rather use a different editor, change it with git config -global core.editor your-favorite-text-editor. Vim doesn't work like most modern text editors, so take a look at how to rebase using Vim. ![]() On many systems, git rebase -i will open up Vim by default. * Also, don't rewrite history on any branches you're collaborating on. * Watch out for options like -hard and -force though - they can discard data. ProTip™: Don't be afraid to experiment with "dangerous" commands that rewrite history* - Git doesn't delete your commits for 90 days by default you can find them in the reflog: $ git reset # go back 3 commitsĬ4f708b reset: moving to commit: more changes Read more about rewriting history in the Git docs. Note: is shorthand for HEAD, and ~ is the commit before the specified commit. You may be asked to fix some merge conflicts. Then, run git rebase -continue, and Git will replay the subsequent changes on top of your modified commit. The latter is useful for doing more complex stuff like splitting into multiple commits. take you to the point you were at when you'd edited the files, but hadn't committed yet).
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |