Git特殊场景清单

100 阅读1分钟

Git将某个文件重置到某次提交commit

git log ./src/xxx
# 复制commit
git checkout [commit id] ./src/xxx

Git合并时使用当前分支或合入分支的代码

# 使用当前分支代码
git checkout --ours ./src/xxx
# 使用合入分支代码
git checkout --theirs ./src/xxx

Git切换pull合并策略

# 使用rebase
git config --global pull.rebase true
# 使用merge
git config --global pull.rebase false