迷失在GIT上的提交

时间:2013-05-16 13:00:29

标签: github git-commit

我和我的合作伙伴正在使用git遥控器,并且都具有对遥控器的写入权限。

他做了一些改变,提交了他们并把他们推到了远方,

我在我的机器上做了一些更改而没有取/拉只是用力推动了我的提交。 这反过来导致了我的伴侣的遗失。

所以我有两个问题:

1。有没有办法让这些提交回来?

2。在我推动之后,我的合作伙伴会从他的机器中取出,取出他所做的更改吗?

1 个答案:

答案 0 :(得分:0)

如果你推送覆盖别人代码的提交,并且没有提取; git会抛出这样的错误:

error: failed to push some refs to 'git@github.com:foo'
To prevent you from losing history, non-fast-forward updates were rejected
Merge the remote changes before pushing again.  See the 'non-fast forward'
section of 'git push --help' for details.

如果您确实覆盖了某些内容,则可以恢复整个git仓库。有关示例,请参阅此堆栈溢出问题: How do I restore files to previous states in git?