Backlog uses cookies to deliver our services. By visiting our website, you agree to the use of cookies as described in our Cookie Policy.

For this tutorial step, we have prepared a repository with some ready made commits to speed things up.

You can download the repository here.

Go to the downloaded "stepup-tutorial/tutorial5" directory and examine the history of this repository. It should look like the following.

In this step, we are going to combine the two commits "append description of the commit command" and "append description of the pull command" into a single commit.

Current history

In order to do that, we will use "rebase -i".

$ git rebase -i HEAD~~

Your default text editor should open and you will be on rebase interactive mode showing commits from HEAD to HEAD~~ as shown below.

pick 9a54fd4 append description of the commit command pick 0d4a808 append description of the pull command # Rebase 326fc9f..0d4a808 onto d286baa # # 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 discard this commit's log message # x, exec = run command (the rest of the line) using shell # # If you remove a line here THAT COMMIT WILL BE LOST. # However, if you remove everything, the rebase will be aborted. #

On the second line/commit, change the word "pick" to "squash", then save and quit. The editor will now prompt you to edit the commit message of this newly formed commit. Edit the commit message, then save and quit.

The previous two commits are now quashed into a single new commit. You can verify the result by checking the history log using the log command.

organize commit