3

When I was researching the best way to merge a feature branch with a lot of WIP commits I came across squashing and rebasing however when looking how to do this in magit I found this sentence in the magit documentation on the magit-merge-squash command:

Instead of this command you should probably use a command from the apply popup.

Why is that the case? Is it considered bad practice? If so what would be the correct way?

5
  • Probably github.com/magit/magit/issues/3348#issuecomment-361056697 explains this
    – npostavs
    Mar 5, 2018 at 12:54
  • When you do it the way tarsius describes it. Does it then squash all the commits into one commit? I was thinking about using the git merge --squash command because I often have small commits like "Fix typo" in the feature branch which I don't really need in the master branch. It somehow feels cleaner to just have a single commit with "add feature x" to add a new feature without all the WIP commits. Mar 5, 2018 at 15:10
  • A a does git cherry-pick --no-commit, so you get the changes without any commits.
    – npostavs
    Mar 5, 2018 at 23:47
  • I often have small commits like "Fix typo" in the feature branch which I don't really need in the master branch...' Another way to deal with that is to use fixup commits and rebasing. Magit makes this convenient with commands like magit-commit-instant-fixup.
    – Kyle Meyer
    Mar 5, 2018 at 23:48
  • Thanks for all the information. I will have to do a few tests to see which way makes more sense in my workflow. Mar 7, 2018 at 11:05

1 Answer 1

0

Okay after trying out the suggestions and reading a bit more (especially, https://softwareengineering.stackexchange.com/questions/263164/why-squash-git-commits-for-pull-requests) I came to the conclusion that despite what the documentation says the command magit-merge-squash seems to be the command I want to use when merging a feature branch into master.

Thanks all for your help!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.