[英]git push does not push latest commit to remote
git push does not push latest commit to remote. git push不会将最新提交推送到远程。
git keeps push outdated commit to remote! git继续将过时的提交推送到远程! Not the commits I locally amended before push.
不是在推送之前我在本地修改的提交。
How can I force git to cleanup and don't remember the stale commits? 我该如何强制git进行清理,并且不记得过时的提交?
Added Information: git 2.1.0 新增信息:git 2.1.0
git branch
shows detached stategit branch
显示分离状态
That would explain why pushing a branch to any remote would push an "outdated" commit: the branch still refer to the old commit, while the new amended commit (referenced by HEAD) is detached from any branch. 那可以解释为什么将分支推送到任何远程都会推送“过时”的提交:分支仍然引用旧的提交,而新修改的提交(由HEAD引用)与任何分支分离。
You can force a branch to reset to the current HEAD 您可以强制分支重置为当前HEAD
git branch -f master HEAD
That would reset the branch master to the current amended commit. 这样会将分支主服务器重置为当前修订的提交。
Then you can create a new Gitlab repo, and git push -u origin master
. 然后,您可以创建一个新的Gitlab存储库和
git push -u origin master
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.