git - 在 `git rebase` 期间自动化 `--ours` 和 `--theirs`
问题描述
我有一个 500 次提交的长变基,我必须为每个提交指定相同的文件来支持github checkout --ours file.py
它--theirs
;有没有办法通过告诉Git Bash将此首选项应用于所有进一步的冲突来自动执行此操作?
解决方案
如果这是一个轻率的过程,那么请随意编写脚本……例如:
git rebase blahblahblah
if [ $? -ne 0 ]; then
# rebase stopped for whatever reason
while true; do
git checkout --ours blahblah
# more commands to specify what should be attempted with each file
git add . # add all files.... perhaps something a little mlre specific would help
# let's try again
GIT_EDITOR=/bin/true git rebase --continue
if [ $? -eq 0 ]; then
break # we are done
fi
done
fi
推荐阅读
- laravel - 如何在 laravel 查询中使用 sum 和 groupBy
- javascript - 这篇反应文章中的“关闭”是什么意思?
- c# - 如何使用手动设置的 RSA 参数加密和解密字符串?为什么 RSACryptoServiceProvider 抛出?
- vue.js - Vue.js VueX 属性未定义问题
- php - php 插入我的数据库后,日期始终为 1970-01-01 和 2018-08-31
- react-native - 如何修复错误“没有这样的规模错误:无法发布 CodePush 更新”?
- java - 名为 XYZ 的类包含自己作为类成员
- go - 我什么时候应该把对象放回sync.Pool
- javascript - 如何在 webpack 中热重载 html 文件
- angular - 如何检测 rxjs 中更改的单个变量?