# gt goback

The "gt goback" command will let you return to a previous checkpoint created with "gt save".

After executing "gt goback", you'll be prompted with a list of all the previous commits of your project. You can navigate the list with the arrow keys and select the commit you want your project to go back to.

Gitutor collects the list of the commits leading up to the selected commit and reverts each one from the most recent to the oldest with:

$ git revert <hashOfCommit>

The revert command creates a "revert commit" that cancels out the changes introduced by each commit from the list. In this way, the repository returns to the checkpoint specified by the selected commit.

Afterwards, Gitutor will combine all the revert commits into a single one, making it easier to undo. First it'll run:

$ git reset --soft <hashOfCommitBeforeGoBack>

Here, the reset command is executed with the hash of the last commit saved before running goback.

The reset command will remove all the revert commits from the repo's history up to the specified commit, but it will keep their effect on the repo's files. Then, Gitutor will create a new commit:

$ git commit -m "Going back to commit x"

# Options

This commands offers an optional flags:

# --hash

$ gt goback --hash hashOfSelectedCommit

This flag tells gitutor to go back to the checkpoint specified by the hash.