sách gpt4 ăn đã đi

由于更改了文件,Git 不会 pull

In lại 作者:太空狗 更新时间:2023-10-29 13:54:59 30 4
mua khóa gpt4 giày nike

假设我更改了文件,然后进行 pull 。 Git 会报错,因为本地仓库还没有保存,将被覆盖。如果我然后删除该添加并使文件与以前相同(与远程 repo 相同),那么会发生 pull 吗?

câu trả lời hay nhất

是的。这是常见的情况,您在工作目录中进行了一些更改,然后需要 pull 。通常你必须选择:

  • 永久删除您的更改,然后 pull :

    $ git reset --hard
    $ git pull
  • 将您的更改收起,执行 pull 操作,然后将您的更改放回原处:

    $ git stash
    $ git pull
    $ git stash pop # May result in a merge conflict
  • 在 pull 之前提交您的更改:

    $ git add -A . # stage all changes
    $ git commit -m "my commit message"
    $ git pull # May result in a merge conflict

如果您的分支配置为使用“rebase”而不是默认的“merge”,我只能推荐最后的选择(使用提交)。

từ https://git-scm.com/docs/git-config

branch..rebase When true, rebase the branch on top of the fetched branch, instead of merging the default branch from the default remote when "git pull" is run. See "pull.rebase" for doing this in a non branch-specific manner.

When preserve, also pass --preserve-merges along to git rebase so that locally committed merge commits will not be flattened by running git pull.

When the value is interactive, the rebase is run in interactive mode.

NOTE: this is a possibly dangerous operation; do not use it unless you understand the implications (see git-rebase[1] for details).

关于由于更改了文件,Git 不会 pull ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38592621/

30 4 0
Chứng chỉ ICP Bắc Kinh số 000000
Hợp tác quảng cáo: 1813099741@qq.com 6ren.com
Xem sitemap của VNExpress