Git not pushing correctly for Github gh-pages

混江龙づ霸主 提交于 2019-12-11 07:27:37

问题


when I git push, it says "everything up to date", but when I do git branch -vv, it says this:

MacBook-Pro:gitpracticing c$ git branch -vv
gh-pages 19f1cfc made after dinner
* ghpages  4aacdb1 [origin/gh-pages: ahead 11] yea
master   4aacdb1 [origin/gh-pages: ahead 11] yea
MacBook-Pro:gitpracticing corey$ 

even though I do git push, the origin/gh-pages branch is still ahead by 11. How do I fix this? So I have 3 branches: "gh-pages", "ghpages", and "master". I notice that when I'm on the gh-pages branch, I can only push to origin/gh-pages, and not origin/master. When I'm on the master branch, I can only push to origin/master, and not origin/gh-pages. Why is this? How can I push to both?


回答1:


That happens because you setted up ghpages to match origin/ghpages. You can, however, specify the remote branch that will receive your commits using one more parameter in the command

git push origin ghpages:origin/master

More on git push docs, here PS: search for "git push mothership master:satellite/master dev:satellite/dev" for an example of the sollution I gave you.



来源:https://stackoverflow.com/questions/29359754/git-not-pushing-correctly-for-github-gh-pages

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!