簡體   English   中英

在 Git 中合並沖突。在 Git 之前需要本地環境 Stash + Pull

[英]Merge conflict in Git. Need local env prior to Git Stash + Pull

我使用了以下 git 命令:

git stash
git pull

拉取后,命令行顯示:

Auto-merging ...path/ConflictFile.xxx
CONFLICT (content): Merge conflict in ...path/ConflictFile.xxx
Automatic merge failed; fix conflicts and then commit the result.

我為文件 1 中的沖突選擇了“接受傳入的更改”。現在我想退出。

但如果它更改答案以幫助我理解,運行git status現在會顯示以下內容:

Your branch and 'origin/develop' have diverged,
and have 1 and 5 different commits each, respectively.
  (use "git pull" to merge the remote branch into yours)

You have unmerged paths.
  (fix conflicts and run "git commit")
  (use "git merge --abort" to abort the merge)

然后它說(注意這些是同事的文件所以我不明白)

Changes to be committed:
/path/fileHeAdded.xxx
/path/fileHeAdded.xxx
/path/fileHeAdded.xxx
/path/fileHeUpdated.xxx

然后它說:

Unmerged paths:
  (use "git add <file>..." to mark resolution)
        both modified:   path/ConflictFile.xxx
Untracked files:
  (use "git add <file>..." to include in what will be committed)
        path/OneOfMyUntrackedFiles.xxx
        path/AnotherOfMyUntrackedFiles.xxx

最后那些 ^ 有意義,因為它們是我昨天添加但沒有暫存的文件。

我如何撤消 stash 和 pull 以回到運行它們之前的狀態? 我讀到你可以運行 git merge --abort,但是這會刪除存儲還是我需要單獨刪除它?

在了解沖突之前,我只想把事情弄清楚。

謝謝!

撤銷

git stash
git pull

導致合並沖突,比如說

git merge --abort
git stash pop

您的分支將完全位於您說這些話之前的位置。

暫無
暫無

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

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