【问题标题】:Resolve rebase conflicts easily轻松解决变基冲突
【发布时间】:2013-10-30 06:46:13
【问题描述】:

当我从我的功能分支执行: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分支合并到featureBranch_04,然后从featureBranch_04分支合并git pull --rebase

【问题讨论】:

  • 你为什么要做git pull --rebase?为什么不只是 git pull 然后重新设置你的分支?

标签: git git-rebase


【解决方案1】:

你可以试试:

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

这会将pass the merge strategy 'theirs' 转换为 rebase 的合并部分。

【讨论】:

  • 鉴于 rebase 反转了“我们的/他们的”意义,“-s 他们的”不是正确的吗?或者 rebase 是否会更改用户提供的参数以匹配感知交换?
  • @torek 谢谢。固定的。我应该知道,我已经写了很多关于这个的文章:stackoverflow.com/a/3052118/6309
猜你喜欢
  • 2020-07-01
  • 1970-01-01
  • 1970-01-01
  • 2011-01-12
  • 2014-08-29
  • 2012-10-24
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多