vscode 处理拉取和同步时的变基

yshpjwxd  于 9个月前  发布在  Vscode
关注(0)|答案(1)|浏览(96)

问题

使用以下配置之一时:

  • git config: pull.rebase=true
  • vscode settings: "git.rebaseWhenSync": true

如果索引包含未提交的更改,
运行Pull(因此,也同步)时会抛出此错误:

  1. > git pull --tags -r origin master
  2. error: cannot pull with rebase: Your index contains uncommitted changes.
  3. error: Please commit or stash them.

它可以有更好的安全防护措施。

建议的解决方案

  • 对于 git config 配置: pull.rebase=true
  • 如果索引包含未提交的更改,
  • 在尝试拉取时设置安全防护措施
  • 对于 vscode settings 配置: "git.rebaseWhenSync": true
  • 如果索引包含未提交的更改,
  • 创建一个新的 "git.postCommitCommandWhenUncomittedChanges": "none" | "push" 设置,以便在索引不再包含未提交的更改之前临时启用 "git.postCommitCommand": "none""git.postCommitCommand": "push"
  • 在尝试同步时设置安全防护措施
nsc4cvqm

nsc4cvqm1#

在使用Gerrit时,上下文非常重要,许多人使用git pull --rebase拉取更改,然后使用git push origin HEAD:refs/for/master推送更改。Gerrit被许多组织使用。

相关问题