问题
使用以下配置之一时:
- git config:
pull.rebase=true
- vscode settings:
"git.rebaseWhenSync": true
如果索引包含未提交的更改,
运行Pull(因此,也同步)时会抛出此错误:
> git pull --tags -r origin master
error: cannot pull with rebase: Your index contains uncommitted changes.
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"
。 - 在尝试同步时设置安全防护措施
1条答案
按热度按时间nsc4cvqm1#
在使用Gerrit时,上下文非常重要,许多人使用
git pull --rebase
拉取更改,然后使用git push origin HEAD:refs/for/master
推送更改。Gerrit被许多组织使用。