![](/img/trans.png)
[英]How to resolve GIT conflict if I forgot to push the commits and created a feature branch from my local develop branch?
[英]How to push my commits from a new local branch to the remote branch in Git
遠程倉庫有master和staging分支,我只能在staging中工作。 我要做的第一件事是將存儲庫克隆到本地計算機上。 然后,我使用git checkout -b form origin/staging
來創建和簽出新的本地分支,並使該分支跟蹤origin/staging
遠程。
現在,我有幾個提交,並准備將其提交到階段。 我怎么做? 我可以簡單地輸入git push嗎? 如果我這樣做了,它將只是將我的提交推送到遠程計算機上的暫存分支中,還是將一個新的名為Forms的分支創建到倉庫中,這不是我想要的。
您可以使用:
git push repo_name from:to
因此,對於您的情況:
git push origin form:staging
您可能需要先更新代碼:
# will update merging
git pull
要么:
# will update rebasing
git pull --rebase
對於rebase和merge之間的區別,請檢查this 。
您還可以將更改的form
傳遞給staging
本地分支:
# to change local branch
git checkout staging
# to get changes from form branch in staging branch
git merge form
# to push corresponding branch
git push
這樣,您就不必from:to
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.