Git Historical Email Fix,Rebase Mistake

时间:2017-09-08 04:09:12

标签: git github rebase git-filter-branch

我不小心用错误的邮件推送到GitHub。

我重新写了'使用这篇文章的历史记录:Git, rewrite previous commit usernames and emails

git change-commits GIT_AUTHOR_EMAIL "old@email.com" "new@email.com"
git push origin +master

我现在明白我创建了一组镜像原始历史的新提交。当我的同事拉,他的git客户端合并了原始和新的历史(我认为他应该删除/重新克隆):

Parallel histories

我非常确定另一个变种&重新克隆会修复它,但在我搞砸之前,我想我应该问。我们在同一个办公室只有两个开发人员(因此很容易重新克隆)。

问题:如何保留RED分支并永久丢弃BLUE的等效部分?

1 个答案:

答案 0 :(得分:2)

git checkout master
git reset a281b77 --hard
#if you'd like to keep the blue and discard the red
#git reset ed6bd16 --hard

在当地已经完成了。如果已将带有红色和蓝色的混合分支推送到服务器,请运行命令在服务器中更新它:

git push origin -f master