【发布时间】:2021-11-14 18:43:08
【问题描述】:
我最近在本地创建了一个新分支,将其发布到远程,它收到了同事的更新。
虽然我的存储库中确实有更改,但它们都没有在已修改的文件上。
因此,我希望 git pull 会像来自 git status 的消息所暗示的那样工作:
$ git status
On branch XXX
Your branch is behind 'origin/XXX' by 2 commits, and can be fast-forwarded.
(use "git pull" to update your local branch)
Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git restore <file>..." to discard changes in working directory)
modified: ...
但是,拉取会导致一条错误消息,暗示正在进行变基:
$ git pull
error: cannot pull with rebase: You have unstaged changes.
error: please commit or stash them.
我不知道这可能来自哪里,因为我从未有意识地进行过 rebase。 另外,奇怪的是:
$ git rebase --continue
fatal: No rebase in progress?
我可以在存储我的更改时拉取它们,然后毫无问题地弹出它们,并且知道自动存储选项,但我想了解这里发生了什么。
变基从何而来? 为什么 git pull 和 git rebase 似乎不同意是否存在变基? 我该如何收拾这个烂摊子?
【问题讨论】:
标签: git git-rebase git-pull git-stash