
When you enable the Interactive Rebase, if you have set up VsCode as the default editor for git, when you run the git rebase -i. If you change your mind during the rebase, you can abort the operation or close the file or click the "Abort" button.īut the magic doesn't end here. When you're done, you can click the button in the bottom right, "Start Rebase", so the rebase will be completed. Here you can handle the rebase using drag and drop if you want to move the commit, or you can change the action for the commit using a simple dropdown. The view that appears is something like this It goes without saying that you have to choose the interactive rebase. Then you have to choose between two types of rebase, the normal and the interactive. Right-click on the interested commit and choose "Rebase Current Branch onto Commit". Now you can use it from the commit history. So now it's time to see how the interactive rebase becomes easier with GitLens.įirst, you have to enable the feature from the command palette in this way.
Git rebase reword series#
The goal of this series is not to forget or don't learn git, but to help you understand how you can improve your developer experience with git using GitLens. When you've finished fixing the history, you can save the file, close it and voila, your interactive rebase is completed.įirst, you must know this flow before moving to the next solution. # However, if you remove everything, the rebase will be aborted. # If you remove a line here THAT COMMIT WILL BE LOST. The is # updated at the end of the rebase # These lines can be re-ordered they are executed from top to bottom. # Rebase bf2478f.c7a47a9 onto bf2478f (2 commands) # Commands: # p, pick = use commit # r, reword = use commit, but edit the commit message # e, edit = use commit, but stop for amending # s, squash = use commit, but meld into previous commit # f, fixup = like "squash" but keep only the previous # commit's log message, unless -C is used, in which case # keep only this commit's message -c is same as -C but # opens the editor # x, exec = run command (the rest of the line) using shell # b, break = stop here (continue rebase later with 'git rebase -continue') # d, drop = remove commit # l, label = label current HEAD with a name # t, reset = reset HEAD to a label # m, merge # create a merge commit using the original merge commit's # message (or the oneline, if no original merge commit was # specified) use -c to reword the commit message # u, update-ref = track a placeholder for the to be updated # to this position in the new commits.

Now you can handle your rebase from your best editor, in my case VsCode. Now, you have to get the SHA of the commit from where you want to start the interactive rebase and run the command > git rebase -i bf2478f

This command returns the list of the commit If you have to do that by CLI, you should follow many steps: > git log -oneline I commit a lot, and then before pushing the result, I try to make the history more readable. One of the processes I typically do in my daily work is interactive rebase.
