远程单反: PR 显示你的更改 + 其他团队成员的更改,而不是只显示你在 PR 中的更改(在使用 git pull 在本地解决冲突后)
重现问题的步骤:
git checkout -b "feature"
git pull origin master
(获取更改并解决冲突)git push origin/feature
并打开 PR预期结果: git PR 应该只显示 your 更改
实际结果: git PR 显示你的更改 + 其他团队成员更改已经在 master 分支中
这是我的 git 配置:
init.defaultbranch=main
branch.autosetuprebase=always
branch.master.rebase=true
branch.upstream.rebase=true
pull.rebase=true
rebase.autostash=true
我该如何解决这个问题?
更安全的命令序列是:
# work on feature branch
git fetch
git rebase origin/master
git push -u origin feature
如果你的 PR 目标是
master
,那么只有你的提交应该是可见的。