簡體   English   中英

如何將本地 master 拉入本地分支

[英]How to pull local master into local branch

我有一個遠程origin/master和一個遠程分支remote_branch 我也有本地master和本地分支local_branch 當我嘗試使用git pull master local_branch將本地master拉入local_branch ,我得到了這個。

fatal: 'master' does not appear to be a git repository
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.

但是,當我執行git branch我看到了:

* loca_branch
  master

為什么我不能從我的本地master那里拉?

將 local_branch 的更改合並master

git checkout master
git merge local_branch

合並從 masterlocal_branch 的更改

git checkout local_branch
git merge master

拉是當你有一個“原點”回購:)

git pullgit fetch && git merge的別名,您無法從本地分支(僅從遠程)獲取 - 實際上您不需要,如果您打算將master合並到local_branch ,只需在打開時使用git merge master local_branch

正如錯誤消息所說, master不是它知道的存儲庫。 這是因為使用git pull master local_branch您說“從遠程存儲庫master獲取分支local_branch並將其合並到我當前簽出的分支中”。

但這不是你所追求的。 您想說“將我的本地分支master合並到我的本地分支local_branch ,檢查它是否還沒有”,那就是git checkout local_branch && git merge master

暫無
暫無

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

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