Git: delete a single remote revision

后端 未结 1 1414
萌比男神i
萌比男神i 2021-02-06 11:04

I\'ve started switching my private subversion projects to git (Github) and release the code to the public. Therefore, I am a git newbie.

Unfortunately, there is a revisi

1条回答
  •  执念已碎
    2021-02-06 11:34

    The post located here solved my problem.

    If the commit you want to fix isn’t the most recent one:

    1. git rebase --interactive $parent_of_flawed_commit

      If you want to fix several flawed commits, pass the parent of the oldest one of them.

    2. An editor will come up, with a list of all commits since the one you gave.

      1. Change pick to edit in front of any commits you want to fix.
      2. Once you save, git will replay the listed commits.
    3. Git will drop back to the shell for every commit you said you want to edit:

      1. Change the commit in any way you like.
      2. git commit --amend
      3. git rebase --continue

    Most of this sequence will be explained to you by the output of the various commands as you go. It’s very easy, you don’t need to memorise it – just remember that git rebase --interactive lets you correct commits no matter how long ago they were.

    0 讨论(0)
提交回复
热议问题