我一直在处理git存储库,并且一直将本地更改推到远程服务器上.直到最近。当我推它的时候,它说一切都是最新的。实际上,我已经3岁了,在远程版本之前提交,它没有得到我的更改。
我尝试过git日志-1,git重置-硬解决方案张贴在不同的地方,但这不能解决任何问题。我是否需要更改这个数字以反映我领先的提交次数?
假设我有5次提交,为了brevetys命名为1到5。我的本地版本为5,远程版本为2。Gitk显示我的主机在提交5,远程/原产地/主在提交2。我是否需要将我的本地版本重置为2(或3,第一个未被推送到远程的提交)?我的改变会怎么样?git文档说我想保留这3次提交的提交历史,因为已经做了相当多的更改。
发布于 2014-01-31 16:04:35
首先,仔细检查您的配置。
什么能帮到你:
$ git log --full-history // is your commit really there?
$ git reflog // operation history
$ git remote -v // what are your remotes?
$ git remote show DESIRED_REPO // do you have the remote repo you wanted to push to configured? the DESIRED_REPO?最后,确保您使用的是正确的推送符号:
git push public和git push --repo=public是有区别的。第一次总是公开,第二次是,只有当远程为您正在推动的没有设置时。$ git push remote local_branch:remote_branch // I've made this error today by swapping places, with remote_branch:local_branch Git will not find the branch to update.
希望这能有所帮助。在我的例子中,仔细地重新阅读手册,同时重新检查我尝试过的命令,帮助并揭示了问题(交换了分支名称)。
发布于 2015-10-14 02:07:53
几分钟前,我也处于同样的情况(这就是为什么我在这条线上徘徊)。Anwyay,我能够通过git push origin master而不仅仅是git push来解决这个问题。
这发生在我创建了一个新的分支,开始推到新的分支,然后回到主分支,并试图再次推到那个分支。
https://stackoverflow.com/questions/16029895
复制相似问题