想知道为什么我不能推送到原点。下面是一步一步的..。
git clone git@github.com:globegit/aRepository.git
cd aRepository
git branch --track mymaster master
git checkout master
git mv oldfile newfile
git status
- On branch mymaster
- Changes to be committed:
- (use "git reset HEAD <file>..." to unstage)
-
- renamed: oldfile -> newfile
-
git commit -m 'renamed a file'
git status
- On branch mymaster
- Your branch is ahead of 'master' by 1 commit.
-
nothing to commit (working directory clean) 很好,但是为什么我不能把这个更改推送到远程呢?
git-mv不被认为是一种改变,所以它认为我甚至是最新的
使用新的提交对象?
git push
Everything up-to-date
git push origin master
Everything up-to-date 谢谢你的解释!
发布于 2011-08-31 08:13:52
您已经向没有远程跟踪分支的分支(mymaster)提交了更改,而正在跟踪远程分支(分别为master和origin/master )的分支没有任何更改。
您必须将更改合并到master中,然后才能将它们推送到origin/master,或者将mymaster分支推送到服务器。
因此,要么:
git checkout master
git merge mymaster
git push或
git push --set-upstream origin mymaster发布于 2011-08-31 08:18:19
默认行为:
git push -> git push origin -> git push origin :
git push origin :推送匹配的分支:对于本地端上存在的每个分支,如果远程端上已存在同名分支,则远程端将更新。
所以分支不存在于远程,它显示为Everything up-to-date
在你的命令列表中,你写了git checkout master --那应该是mymaster吗?既然你似乎在mymaster上工作。你必须像这样推:
git push origin mymaster
因此git将在远程创建mymaster。
或者,既然你似乎想要掌握,也许:
git push origin mymaster:master
或
git push origin HEAD:master
http://www.kernel.org/pub/software/scm/git/docs/git-push.html#OPTIONS
发布于 2011-08-31 08:42:32
您正在提交mymaster并尝试推送master。这是最新的。如果您想将mymaster推送到远程主机,请执行以下操作
git push origin mymaster:master表格是
git push <where> <yourlocalbranch>:<theremotebranch>https://stackoverflow.com/questions/7251161
复制相似问题