簡體   English   中英

Git 與遠程分支問題合並

[英]Git merge with remote branch issue

我正在嘗試將我的本地倉庫與遠程倉庫分支合並。

我做了什么 -

> git status
On branch dev
Your branch is up to date with 'origin/dev'.

Changes not staged for commit:
  (use "git add/rm <file>..." to update what will be committed)
  (use "git checkout -- <file>..." to discard changes in working directory)

        deleted:    api.zip
        modified:   models/event.js

no changes added to commit (use "git add" and/or "git commit -a")

然后我做到了,

> git pull origin dev

 * branch            dev -> FETCH_HEAD
   19d5d3e..86e0adc  dev -> origin/dev
error: Your local changes to the following files would be overwritten by merge:
        models/event.js
Please commit your changes or stash them before you merge.
Aborting
Updating 19d5d3e..86e0adc

然后我做了

> git stash
Saved working directory and index state WIP on dev: 19d5d3e Add banner text

> git pull origin dev
 * branch            dev -> FETCH_HEAD
Updating 19d5d3e..86e0adc
Fast-forward
 models/event.js | 6166 ++++++++++++++++++++++++++++---------------------------
 1 file changed, 3084 insertions(+), 3082 deletions(-)

> git stash pop
Auto-merging models/event.js
CONFLICT (content): Merge conflict in models/event.js
Removing api.zip


>git status
On branch dev
Your branch is up to date with 'origin/dev'.

Changes to be committed:
  (use "git reset HEAD <file>..." to unstage)

        deleted:    api.zip

Unmerged paths:
  (use "git reset HEAD <file>..." to unstage)
  (use "git add <file>..." to mark resolution)

        both modified:   models/event.js


>git stash apply --index
models/event.js: needs merge
unable to refresh index

我該如何合並? 非常感謝任何幫助。

models/event.js中存在沖突。 您應該手動解決它,然后git add models/event.js

首先,檢查您的存儲以驗證它是否僅包含對 event.js 所做的更改然后試試這個

git reset --hard origin/dev
git stash pop

然后解決任何合並沖突。

暫無
暫無

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

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