Sourcetree - undo unpushed commits

前端 未结 4 1484
一个人的身影
一个人的身影 2020-12-12 09:08

I am using Sourcetree for Windows for a git-repository and would like to undo an unpushed commit.

Is that possible? If I do \"revert commit\", it creates a second co

4条回答
  •  北荒
    北荒 (楼主)
    2020-12-12 10:09

    If you want to delete a commit you can do it as part of an interactive rebase. But do it with caution, so you don't end up messing up your repo.

    In Sourcetree:

    1. Right click a commit that's older than the one you want to delete, and choose "Rebase children of xxxx interactively...". The one you click will be your "base" and you can make changes to every commit made after that one.

    1. In the new window, select the commit you want gone, and press the "Delete"-button at the bottom, or right click the commit and click "Delete commit".
    2. List item
    3. Click "OK" (or "Cancel" if you want to abort).

    Check out this Atlassian blog post for more on interactive rebasing in Sourcetree.

提交回复
热议问题