Upon saving and closing this file, git will go to work. Secondly, I chose to squash or fixup several of the commits that were work in progress commits or fixes for issues I might have created while working on this branch (minor typos, formatting, work-in-progress commits).įinally, I chose to reword the first commit message because it contains a typo. This makes it easier to squash and follow the git history. # Note that empty commits are commented outĮnter fullscreen mode Exit fullscreen modeįirst, I grouped the documentation commits together. # However, if you remove everything, the rebase will be aborted. # If you remove a line here THAT COMMIT WILL BE LOST. # These lines can be re-ordered they are executed from top to bottom. message (or the oneline, if no original merge commit was create a merge commit using the original merge commit's # l, label = label current HEAD with a name # b, break = stop here (continue rebase later with 'git rebase -continue') # x, exec = run command (the rest of the line) using shell # f, fixup = like "squash", but discard this commit's log message # s, squash = use commit, but meld into previous commit # e, edit = use commit, but stop for amending # r, reword = use commit, but edit the commit message Pick f8a81956e2 Fix documentation formatting Pick 61b6f8ea3e Fix a typo from my doc changes Pick f0978af68d Fixed the very annoying bug Pick 6dbc838bae WIP forgot something from that feature Pick 47a0a7008b Add a rea322ally cool feature In our scenario, we can imagine that we've got a branch called some-feature which looks something like the following: When it comes to git, we frequently make incomplete commits, forget to include important changes, or make bad commit messages. Unfortunately, the real world is rarely ideal. In many ways, the process we previously followed is ideal we didn't have to do any work, git handled everything for us! In the previous article, we used rebase to bring upstream changes into our branch, but we didn't manipulate any commits in that process. Interactive mode allows the programmer to influence how rebase executes. Why is it called the interactive mode? Glad you asked. Running git rebase -i invokes a rebase in interactive mode. This article will provide a glimpse into more powerful applications of the command. If you're unfamiliar with rebase, I'd give the previous article a look before reading this one. It is my preferred method of organizing code changes good organization makes git a more powerful tool. I'm talking using git rebase in the optional interactive mode. Choosing to rebase in this way allows me to convey the purpose and reasoning behind commits with clarity. In this article, I'm going to explain a more intimidating application of git rebase. There I tried to ensure that anyone could glean the purpose and basic application of git rebase. Recently (not that recently), I wrote an article explaining the oft-misunderstood git command: git rebase.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |