How can we get one of these commits? Rather than manually typing out fixup! in your fixup commit messages, git provides some help: git commit -fixup $ git log -oneline So if we can get a fixup commit titled "fixup! ", git rebase -i -autosquash will save us from having to perform steps 6 and 7 from the naïve workflow. It will change the rebase command to fixup or squash, respectively.It will reorder commits with log messages starting with fixup! or squash! so that they are applied immediately after the commits with the same title (following those prefixes). Git's interactive rebase provides an -autosquash option which will help us in two ways: # The dirty working tree is preserved through the rebase # Successfully rebased and updated refs/heads/master. # Using -autostash allows us to rebase anyway # Cannot rebase: You have unstaged changes. # The working tree is dirty so regular rebase is forbidden Git rebase -i -autostash takes care of this for us, and saves us from having to perform steps 2 and 9 in the naïve workflow. without any staged or unstaged changes, so if you're in the spot where you're not ready to commit changes, but need to perform a rebase, you must first stash your changes and then unstash them later on. Git only allows rebases when the working tree is clean, i.e. Git's interactive rebase provides an -autostash option which will automatically stash uncommitted changes, then pop those changes back into your working tree after the rebase is executed. Having to use a text editor for the interactive rebase, improved by using GIT_SEQUENCE_EDITOR.Selecting the revision to fix, improved with :/.Reordering and squashing the fixup commit, improved with -autosquash.Stashing and unstashing unrelated changes, improved with -autostash.There are 4 big areas in which this workflow can be improved: git stash pop to restore the unrelated changes to my working tree.Reorder the commits so that my fixup commit is applied after the commit to be fixed.
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |