Skip to content

Commit 1ec323e

Browse files
authored
Configuration for git to ignore generated test output on rebase/merge (#3773)
## Why Having output file in conflicted state requires marking them as resolve manually which adds to rebase/merge toil. You're going to regenerate them anyway, so no need to spend time on these conflicts. ## Tests Manually, by creating a conflicting change in script & output.txt: ``` % git rebase -i a Auto-merging acceptance/selftest/basic/output.txt Auto-merging acceptance/selftest/basic/script CONFLICT (content): Merge conflict in acceptance/selftest/basic/script error: could not apply 73b9af638... update Y ... Could not apply 73b9af638... # update Y ```
1 parent 4ce8685 commit 1ec323e

File tree

3 files changed

+12
-0
lines changed

3 files changed

+12
-0
lines changed

.gitconfig

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
[merge "ours"]
2+
# define merge driver "ours" that will do nothing which will make git
3+
# accept the file from the branch the we rebase onto as final version, ignoring local changes.
4+
# https://git-scm.com/docs/gitattributes#_defining_a_custom_merge_driver
5+
driver = true

.gitconfig.install

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#!/bin/bash
2+
set -ex
3+
git config --local include.path "$(git rev-parse --show-toplevel)/.gitconfig"

acceptance/.gitattributes

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,7 @@
66

77
# The out.test.toml file is autogenerated based on the merged test.toml view.
88
out.test.toml linguist-generated=true
9+
10+
# Do not mark generated files as conflicted, they should simply be regenerated.
11+
# Note, you need top run .gitconfig.install to enable 'ours' driver
12+
out* merge=ours

0 commit comments

Comments
 (0)