【问题标题】:delete merge and commit in remote git repository删除远程 git 存储库中的合并和提交
【发布时间】:2020-07-16 21:08:38
【问题描述】:

不幸的是,我使用由 IDE 创建的默认作者姓名从 Spring Tool Suite 提交。之后我用命令更改了作者姓名

git commit --amend author="<my-correct-name> <my-correct-mail>"

Git 创建另一个具有相同更改和正确作者的提交。然后它让我在 master 上合并,但再次使用默认作者姓名。现在是这样的情况: git bash screen 我只想保留带有红色勾号的提交并删除另外两个。有没有人有什么建议?谢谢

【问题讨论】:

  • git reset --hard HEAD~1 和 git push --force

标签: git github merge version-control commit


【解决方案1】:

在提交之前移动你的 HEAD

git checkout <name_of_commit_before_this_three_commits>

然后添加必要的提交

git cherry-pick 52af2ce....

然后删除master分支

git branch -D master

然后在你的 HEAD 上重新创建 master 分支

git checkout -b master

【讨论】:

  • 干得好,谢谢...但是现在,我如何更新 github 上的远程 repo 并将其拉到我的 IDE 上?
  • 尝试 'git push -f origin master' 来更新远程仓库
猜你喜欢
  • 2015-11-05
  • 1970-01-01
  • 2012-11-28
  • 2011-01-01
  • 2017-10-24
  • 2012-01-03
  • 1970-01-01
  • 1970-01-01
  • 2013-03-26
相关资源
最近更新 更多