【发布时间】:2015-12-03 13:52:33
【问题描述】:
我是 Git 的初学者。所以这是场景,在一个空的文本文件中,我添加了One String 并执行了以下命令:
git init
git add sample.txt
git commit -m "Added One"
git push origin master
接下来,我在下一行添加了Two,并执行了以下命令:
git add sample.txt
git commit -m "Added Two"
git push origin master
直到Three 使它包含:
One
Two
Three
然后我执行git reset --hard 'value of the first commit here' 带回包含One 的文件并添加Four 使其:
One
Four
所以当我执行提交和推送时,显示以下错误:
Updates were rejected because the tip of your current branch is behind its remote counterpart.
如何推送我的提交拒绝其他 2 个提交,以便最终文本文件包含:
One
Four
【问题讨论】: