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

Change merge driver for CHANGELOG.md to resolve conflict problem #3594

Merged
merged 1 commit into from
Oct 11, 2016

Conversation

pocke
Copy link
Collaborator

@pocke pocke commented Oct 10, 2016

Currently Problem

CHANGELOG.md is very often conflict when PR.
It's very troublesome.
e.g. #3588 (comment)

Solution

I've added a .gitattributes file.
The file changes a merge driver to union for CHANGELOG.md.

The union driver has what it takes to merge CHANGELOG.md.
With the setting, CHANGELOG doesn't conflict!
Always both of the addition is chosen.

However, this solution has a problem.
GitHub doesn't support the feature.
So, We can't merge a PR at GitHub Web if CHANGELOG.md conflicts.

Don't worry, hub command supports the feature.
Maintainer can merge a conflicted PR by hub command.
For example.

$ git branch
* master
some-feature-branch-1

# merge a branch
$ hub merge https://github.com/bbatsov/rubocop/pull/xxxx # specify a PR url
# push merge commit and merge a PR in GitHub
$ git push

I think this method is not complete, but it is better than now.
What do you think?

More Information


Before submitting the PR make sure the following are checked:

  • Wrote good commit messages.
  • Commit message starts with [Fix #issue-number] (if the related issue exists).
  • Used the same coding conventions as the rest of the project.
  • Feature branch is up-to-date with master (if not - rebase it).
  • Squashed related commits together.
  • Added tests.
  • Added an entry to the Changelog if the new code introduces user-observable changes. See changelog entry format.
  • All tests are passing.
  • The new code doesn't generate RuboCop offenses.
  • The PR relates to only one subject with a clear title
    and description in grammatically correct, complete sentences.

Currently Problem
------

CHANGELOG.md is very often conflict when PR.
It's very troublesome.
e.g. rubocop#3588 (comment)

Solution
-----

I've added a `.gitattributes` file.
The file changes a merge driver to union for CHANGELOG.md.

The union driver has what it takes to merge CHANGELOG.md.
With the setting, CHANGELOG doesn't conflict!
Always both of the addition is chosen.

However, this solution has a problem.
GitHub doesn't support the feature.
So, We can't merge a PR at GitHub Web if CHANGELOG.md conflicts.

Don't worry, `hub` command supports the feature.
Maintainer can merge a conflicted PR by hub command.
For example.

```sh
$ git branch
* master
some-feature-branch-1

$ hub merge https://github.com/bbatsov/rubocop/pull/xxxx # specify a PR url
$ git push
```

I think this method is not complete, but it is better than now.
What do you think?

More Information
-----

- http://krlmlr.github.io/using-gitattributes-to-avoid-merge-conflicts/
@bbatsov bbatsov merged commit f689210 into rubocop:master Oct 11, 2016
@bbatsov
Copy link
Collaborator

bbatsov commented Oct 11, 2016

This definitely seems like a step in the right direction to me, but it will still require some manual work on my part.

@pocke pocke deleted the git-merge-union-for-changelog branch October 11, 2016 05:54
backus added a commit to mbj/mutant that referenced this pull request Oct 16, 2016
See rubocop/rubocop#3594 for context on what this is and how it works
backus added a commit to mbj/mutant that referenced this pull request Oct 16, 2016
See rubocop/rubocop#3594 for context on what this is and how it works
backus added a commit to mbj/mutant that referenced this pull request Oct 17, 2016
See rubocop/rubocop#3594 for context on what this is and how it works
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

Successfully merging this pull request may close these issues.

2 participants