是否可以设置git merge进行自动解析? (git rerere) [英] Is it possible to setup git merge for automatic resolving? (git rerere)
问题描述
我有2台笔记本电脑,每个笔记本电脑带有一个纯文本文件,该文件必须同步-用作第三方软件的数据库。客户希望每天同步该文件的内容。
第一个想法是制作一个脚本,该脚本会将文件上传到Dropbox,但是如果出现冲突(两者都用户删除A行,第一个用户添加B行,第二个用户添加C行)Dropbox创建一个单独的文件。
编辑:本来要提到,但是忘了说:如果发生冲突,B行和C行都应替换A行-同时采取策略。
第二个想法是将文件放入存储库,听起来很容易,但是我不确定如何设置自动解析,因为我不想在此过程中出现合并工具GUI。
您具有 git rerere
命令来寻求帮助。
I have 2 laptops with one plaintext file, which has to be synced - it is used as a database for a 3rd party software. Customer wants to sync the content of that file on a daily manner.
First idea was to make a script which would upload file to Dropbox, but in case of confilct (both users remove line A and first user add line B instead, second user add line C instead) Dropbox creates a separate file. EDIT: was going to mention, but forgot to say: in case of conflict, both lines B and C should replace line A - "take both" strategy.
Second idea is to put file to repository, sounds easy, but i'm not sure how to setup auto resolving, because i don't want merge tool GUI to appear during the process.
You have the git rerere
command for your help.
This is exactly for this command is for.
git rerere
Recorded Reused Resolution
# enabled the option to record the
git config --global rerere.enabled true
By the way, if you prefer rerere to auto-stage files it solved (I do), you can ask it to: you just need to tweak your configuration like so:
git config --global rerere.autoupdate true
这篇关于是否可以设置git merge进行自动解析? (git rerere)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!