【问题标题】:How to rollback and make new branch from rollback point如何回滚并从回滚点创建新分支
【发布时间】:2022-11-21 17:03:21
【问题描述】:

我在下面有这样的git项目

% git --log

commit 39b6b1d894d0788fdfc09947e1a5f88bf962b142 (HEAD -> master, origin/master, origin/HEAD)
Author: whitebear man <whitebear@whitebearnoMacBook-Air.local>
Date:   Wed Nov 9 15:29:13 2022 +0900

    all

commit 2656df9fb80b5085b4e7a50032712b13e3c407c9
Author: whitebear man <whitebear@whitebearnoMacBook-Air.local>
Date:   Thu Oct 13 13:48:36 2022 +0900

    all

commit d72472d00c649fdc04805d10c856d729e114a014
Author: whitebear man <whitebear@whitebearnoMacBook-Air.local>
Date:   Wed Oct 12 18:23:28 2022 +0900

    all

commit 0878cd86de3a939e8c99e33676abcfe1cfd14daa
Author: whitebear man <whitebear@whitebearnoMacBook-Air.local>
Date:   Tue Oct 11 11:38:58 2022 +0900

    all

commit 21c78ba8cfb811e1ad7dfb035ef5236e619f5d53
Author: whitebear man <whitebear@whitebearnoMacBook-Air.local>
Date:   Mon Oct 10 15:55:48 2022 +0900

    all

commit 9568b4b53fd14febc1ed100efcc6d412d0668471
Author: whitebear man <whitebear@whitebearnoMacBook-Air.local>
Date:   Mon Oct 10 15:37:27 2022 +0900

    all

现在我想回滚提交 21c78ba8cfb811e1ad7dfb035ef5236e619f5d53 并创建新分支。 但是我想保留最新的提交39b6b1d894d0788fdfc09947e1a5f88bf962b142作为主人。

我应该回滚并创建新分支吗?

或创建新分支并回滚??

【问题讨论】:

    标签: git


    【解决方案1】:

    您可以从 21c78ba8 提交创建一个新分支:

    git branch new_branch 21c78ba8
    

    【讨论】:

      猜你喜欢
      • 2011-02-08
      • 2014-10-19
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-07-06
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多