对于合并,我用它来"保持我的"
git merge -X ours foo
Run Code Online (Sandbox Code Playgroud)
这是为了"保留他们的"
git merge -X theirs foo
Run Code Online (Sandbox Code Playgroud)
但是在我最近的合并中,最好保持双方.为了避免手动编辑文件,Git是否有"策略"?
我们有一个ONGOING.md文件,每个开发人员在推送代码时添加项目.
看起来像 :
### Added
- item 1
### Changed
- item 2
Run Code Online (Sandbox Code Playgroud)
当拉/推代码时,所有行都被覆盖,所以我.gitattributes在repo root 添加了一个文件:
ONGOING.md -text merge=union
Run Code Online (Sandbox Code Playgroud)
我希望在此之后保留每个书面行,但事实并非如此,覆盖仍然发生.
处理这个问题的正确方法是什么?
编辑:
好的,它刚刚发生,所以我复制/粘贴我的终端的内容:
$ more fab/hotfix/ONGOING.md
### Added
$ nano fab/hotfix/ONGOING.md; git commit fab/hotfix/ONGOING.md -m "update ongoing"
$ more fab/hotfix/ONGOING.md
### Added
- add slug column to BO fack topic admin page
$ git pull
remote: Enumerating objects: 14, done.
remote: Counting objects: 100% (14/14), done.
remote: Compressing objects: 100% (13/13), done.
remote: Total 14 (delta …Run Code Online (Sandbox Code Playgroud)