我正面临着git push的问题。我创建了一个新分支,创建了一个新文件并通过注释提交了它。然后我做了git push origin master
。我在github上看到了这些变化。
但当我执行git push
时,它不会将更改发送到远程仓库,即远程工作仓库(https://github.com/ / work-repo.git)。
$ git status
# On branch mybranch
nothing to commit (working directory clean)
$ git push
Counting objects: 16, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (6/6), done.
Writing objects: 100% (6/6), 607 bytes, done.
Total 6 (delta 5), reused 0 (delta 0)
To https://github.com/<myuser>/work-repo.git
16ff794..55e4338 master -> master
当我转到www github,并尝试在远程work-repo上执行'Pull Request'时,我看到有多个提交(来自我的其他git分支+此当前分支),我无法选择这个拉动请求中的这个。
早些时候,对于其他分支机构,git push
工作正常,并将更改发送到远程工作回购。我这次不知道是什么问题。
我应该检查什么?
更新
当我做git push -u origin <your_local_branch_name>:<your_remote_branch_name>
时,我收到了这个消息:
git push -u origin mybranch:master
To https://github.com/<myuser>/work-repo.git
! [rejected] mybranch -> master (non-fast-forward)
error: failed to push some refs to 'https://github.com/<myuser>/work-repo.git'
hint: Updates were rejected because a pushed branch tip is behind its remote
hint: counterpart. Check out this branch and merge the remote changes
hint: (e.g. 'git pull') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.
更新 因为我无法弄清楚这一点&amp;没有得到任何回复,我清理了回购并从远程分叉新鲜并重新开始。
Mods :请立即关闭此问题。
感谢。
答案 0 :(得分:0)
试试这个:
git push -u origin <your_local_branch_name>:<your_remote_branch_name>
-u flag使您的本地分支可跟踪,因此如果您执行git push origin
,下次它将知道推送的位置。