gpt4 book ai didi

git - 轻松解决 rebase 冲突

转载 作者:行者123 更新时间:2023-12-05 05:27:23 24 4
gpt4 key购买 nike

当我从我的功能分支执行:git pull --rebase 时,我在很多我从未编辑过的文件中遇到冲突。为了消除这些冲突,我对每个冲突文件执行以下命令集。

git checkout --ours .

git add .

git rebase --continue

烦人的部分是我必须为每次冲突执行此操作。有什么方法可以使用自定义命令配置 git,以便所有命令立即执行。

类似于:

If(featureBranch_04) {
foreach(conflicts)
if(conflictedFile != index.jsp) {
git checkout --ours .
git add .
git rebase --continue
}
}
}

我可以在 git config 中有类似的功能吗?

工作流程是:首先我将master分支 merge 到featureBranch_04,然后从featureBranch_04分支git pull --rebase

最佳答案

你可以试试:

git fetch
git rebase -s recursive -X theirs origin/featureBranch_04

那就是 pass the merge strategy 'theirs'到 rebase 的 merge 部分。

关于git - 轻松解决 rebase 冲突,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19675584/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com