Git will finish the rebase and return you to the terminal. You can change the text ( "i cant' typ goods"), save the file, and close the editor. " to unstage)Īs before, Git is showing the commit message for you to edit. It opens up your text editor one more time, and presents the following information: i cant' typ goods Git then gets to the reword 4ca2acc command. When you're finished making all your changes, you can run git rebase -continue. For each change you make, you'll need to perform a new commit, and you can do that by entering the git commit -amend command. Once you are satisfied with your changes, runĪt this point, you can edit any of the files in your project to make any additional changes. Git gets to the edit dd1475d operation, stops, and prints the following message to the terminal: You can amend the commit now, with Both changes will have the same commit message: "Patch B". fixup merges the changes from c619268 into the commit before it, 6b2481b. It also processes the fixup command ( fixup c619268), since it doesn't require any interaction. Git processes the two pick commands (for pick 7b36971 and pick 6b2481b). When the editor is closed, the rebase continues: pick 1fc6c95 Patch A Otherwise, you have the option of changing the commit message by simply changing the text. If you're happy with these commit messages, you can save the file, and close the editor. This file is Git's way of saying, "Hey, here's what I'm about to do with this squash." It lists the first commit's message ( "Patch A"), and the second commit's message ( "something to add to patch A"). # with '#' will be ignored, and an empty message aborts the commit. # Please enter the commit message for your changes. The file it opens up looks something like this: # This is a combination of two commits. Since this operation requires your input, Git opens your text editor once again. It goes to the next command, squash fa39187. Git skips the first rebase command, pick 1fc6c95, since it doesn't need to do anything. Now, save and close the editor this will start the interactive rebase. We've changed each line's command from pick to the command we're interested in. Squash fa39187 something to add to patch A To start, we'll need to modify the commands in the file to look like this: pick 1fc6c95 Patch A Phew! This sounds like a lot of work, but by taking it one step at a time, we can easily make those changes. Fix the commit message of the misspelled commit ( 4ca2acc), using reword.Split the third commit ( dd1475d) into two smaller commits, using edit.Merge the "A fix for Patch B" commit ( c619268) into the "Patch B" commit ( 6b2481b), and disregard the commit message using fixup.Move the last commit ( 7b36971) up before the "Patch B" commit ( 6b2481b), and keep it as pick.Squash the fifth commit ( fa39187) into the "Patch A" commit ( 1fc6c95), using squash.Pick 7b36971 something to move before patch B Our favorite text editor will display the following lines: pick 1fc6c95 Patch A We'll start our rebase by entering git rebase -interactive HEAD~7 on the terminal. In this example, we will cover all of the git rebase commands available, except for exec.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |