Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multiple pull-request authors adding to AUTHORS creates merge conflicts #4

Open
kemitchell opened this issue Jan 29, 2016 · 8 comments
Assignees

Comments

@kemitchell
Copy link
Member

Hat tip: @bkeepers

@kemitchell kemitchell self-assigned this Jan 29, 2016
@kemitchell
Copy link
Member Author

@mlinksva, the merge conflicts thinkathon is here.

@kemitchell
Copy link
Member Author

I don't suppose there's any way to have GitHub to apply the union built-in merge driver per a .gitattributes file?

union
Run 3-way file level merge for text files, but take lines from both versions, instead of leaving conflict markers. This tends to leave the added lines in the resulting file in random order and the user should verify the result. Do not use this if you do not understand the implications.

https://git-scm.com/docs/gitattributes

@kemitchell
Copy link
Member Author

https://github.com/berneout/union-merge-authors has an example repo with:

  1. master branch with existing contributor lines

  2. first-pr and second-pr branches adding one new contributor each to the bottom of AUTHORS.

  3. .gitattributes file configuring Git to use the union merge strategy for AUTHORS

  4. Resulting, conflict-free AUTHORS file from running:

    git checkout master
    git checkout -b merge-at-command-line
    git merge --no-ff second-pr
    git merge --no-ff first-pr
    git push origin merge-at-command-line

    Which yields:

    # [AUTHORS Certificate text omitted]
    Anna Maintainer <[email protected]>
    Bob Contributor <[email protected]>
    Danielle Contributor <[email protected]>
    Charlie Contributor <[email protected]>
    

@kemitchell
Copy link
Member Author

berneout/union-merge-authors#2 is a pull request showing GitHub does not apply configuration in .gitattributes to determine if there are conflicts. Bummer.

@kemitchell
Copy link
Member Author

Looking into writing a bot that:

  1. Users can add as a collaborator
  2. Merges PRs with CLI Git on request

@kemitchell
Copy link
Member Author

Related: GitLab reduced merge conflicts by 90% with changelog placeholders. Long story short, GitLab were having merge conflict problems with CHANGELOG. The solved initially by adding lots of blank placeholders, and asking people to replace a random one. They eventually went to merge=union, which I mentioned earlier.

@kemitchell
Copy link
Member Author

Related: isaacs/github#487

@mlinksva
Copy link

Naive quest-suggestion: wouldn't adding authors in name or email sorted order rather than to the bottom result in fewer conflicts?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants