Search code examples
gitmergecollaboration

Merging another person's contributions with minor changes


What is a good way to take someone else's contribution and merge it into another branch, but making some minor adjustments in the process? There are no merge difficulties (in fact, a fast-forward would work), but there are some spelling errors and style differences that I would like to adjust.

Obviously, I could merge (fast-forward) and then make the changes and commit again.

I could also do git merge --no-ff --no-commit force a true merge, make the changes, and then commit the merge.

There may be other options that I am not aware of.

Which method will be easiest for me and others to look back on and understand what happened?


Solution

  • Try interactive rebasing.

    I assume the other person's changes are in other/feature and you're merging into master. Do

    git rebase -i master
    

    and mark the commits containing error with edit (or just e), then use git commit --amend and git rebase --continue to edit and loop through the commits.