本文介绍了无法推送到github:一切都是最新的的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

限时删除!!

在github上,我分出了另一个项目的旧版本。我做了一些改变,并试图将它们推到我的github上的fork上。我在本地提交了更改,然后尝试了git push,但这只是告诉我所有内容都是最新的。然而,当我在github上浏览项目时,没有任何改变:它仍然显示我的fork上的文件(来自最新版本),未修改。我如何将更改推送到我的github帐户?



(我意识到这不是太多信息......我还能说什么?我有一种感觉,可能是因为我直接在(home)/ git /(project)中修改文件...?)解决方案


git branch -v表示我的提交是在(不分支)。至于添加,我最初通过Eclipse(使用git插件)提交了更改...当我从命令行添加git时,它似乎没有任何操作




这意味着您处于模式。

您可以添加和提交,但是从上游回购视角(即从GitHub回购),没有新的提交可以推送。 >
您有多种方法可以将您的本地(分离的 HEAD )提交回分支,您可以随后推送这些分支。

请参阅:







OP提到这篇文章是为了解决这个问题:

请注意,不是合并您将以某种方式复制的SHA1,而是可以用脚本记住它,使用 head = $(git rev-parse HEAD)

请参阅


然后,您可以合并分离的 HEAD 回到正确的分支。


On github, I forked an old version of another project. I made some changes and am trying to push them onto my fork on github. I commited the changes locally, then tried git push, but this simply tells me "Everything up-to-date". When I browse the project on github, however, nothing has changed: it still shows the files (from the latest version) on my fork, unmodified. How can I push the changes to my github account?

(I realize this isn't much information...what else can I say? I have a feeling that it may be because I'm modifying the files directly in (home)/git/(project)...?)

解决方案

That means you are in a DETACHED HEAD mode.
You can add and commit, but from the upstream repo point of view (ie from the GitHub repo), no new commits are ready to be pushed.
You have various ways to include your local (detached HEAD) commit back into a branch, which you will be able to push then.
See:

The OP mentions this article in order to fix the situation:
"git: what to do if you commit to no branch"

Note that instead of merging the SHA1 that you would have somehow copied, you can memorize it with a script, using head=$(git rev-parse HEAD):
See "git: reliably switching to a detached HEAD and then restore HEAD later, all from a script".
Then you can merge that detached HEAD back to the right branch.

这篇关于无法推送到github:一切都是最新的的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

1403页,肝出来的..

09-06 16:41