因此,我研究了新功能,並意識到將本地提交到主分支會過於複雜。因此,我創建了一個新的分支如下:如何在不拉動的情況下推送新分支
$ git stash branch project_0.2 [email protected]{0}
當然,問題是,當我嘗試新的分支推送到服務器,我得到:
$ git push origin master
To https://svn.tudelft.nl/git/project.git
! [rejected] master -> master (non-fast-forward)
error: failed to push some refs to 'https://svn.tudelft.nl/git/project.git'
hint: Updates were rejected because a pushed branch tip is behind its remote
hint: counterpart. Check out this branch and integrate the remote changes
hint: (e.g. 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.
我一直在尋找的互聯網和無處不在,我看到我應該git pull
併合並更改。我試過這個(在我做備份之前),我得到:
$ git pull
remote: Counting objects: 1105, done.
remote: Compressing objects: 100% (304/304), done.
remote: Total 725 (delta 501), reused 552 (delta 382)
Receiving objects: 100% (725/725), 5.29 MiB | 0 bytes/s, done.
Resolving deltas: 100% (501/501), completed with 165 local objects.
From https://svn.3me.tudelft.nl/git/project
5d6516c..fd424b5 master -> origin/master
There is no tracking information for the current branch.
Please specify which branch you want to merge with.
See git-pull(1) for details.
git pull <remote> <branch>
If you wish to set tracking information for this branch you can do so with:
git branch --set-upstream-to=origin/<branch> project_0.2
我不知道我應該在這裏做什麼,所以我停了下來。而且,這些變化非常深刻,以致需要我永遠合併。我認爲可能有更智能的方法將分支推送到服務器。通過這種方式,我可以從團隊的其他成員那裏獲得幫助來修復代碼。這可能嗎?
您在創建您的分支最離奇的方式。在任何情況下,典型的工作流程就是推新的分支,然後創建一個回到'master'的pull請求。太多的問題冒險給出答案。 –
@TimBiegeleisen在閱讀[此答案](https://stackoverflow.com/a/30927991/611873)後,它似乎是一個很好的解決方案。 – aaragon
如果你能告訴我們你想要用這個分支做什麼,也許可以給出答案或建議。 –