簡體   English   中英

我如何處理已合並的遠程分支的本地提交?

[英]What do I do with local commits for a remote branch that has been merged?

我在 Mac 和 PC 上使用 Visual Studio 處理同一個項目。

我有一個名為“fixbug”的分支,並且在兩台機器上都工作過。 我以為我已經推送了所有更改,所以在我的 PC 上我將分支合並到 master 並刪除了它。 從那以后,我在另一個分支的 PC 上做了很多工作,但后來意識到缺少一些更改。 事實證明,它們在 mac 端,並且在本地提交到“fixbug”分支,但從未推送到遠程。

我不太了解 git 命令行,我使用 IDE 工具。

對我來說,將這些更改返回到 master 中,然后是我正在進行的當前開發分支的最佳方法是什么? 我是否將它們與 Mac 上的本地主服務器合並,然后推送到遠程,然后在我的 PC 上將更改從主服務器拉到我的開發分支? 如果是這樣,有人可以引導我完成命令以實現這一點嗎?

謝謝。

這些是您要求的步驟。 我將編寫詳細的命令描述,這樣,如果這不是你想要的,你就不會丟失你的工作。

// from your Mac fixbug local branch   
git pull origin master // pulls current master branch to your local PC fixbug branch
git push origin fixbug // pushing your local fixbug branch to remote fixbug branch. 
git checkout master // moving to the branch master
git pull origin fixbug // pulling the remote fixbug branch which contains the missed work
git push origin master // pushing local master to remote git.

//from your PC dev branch
git pull origin master // from your current new working branch, pull the updated master

這對於某些步驟可能會產生沖突,您可以解決這些沖突並繼續前進。 請重新檢查這是否是您想要的。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM