Git merge: is there a way to force --squash?

So, the dev workflow for our project looks like this: we create a ticket with a task / error, and we assign a wizard to work on a task / error, and ultimately combine it with a wizard. We would like the commits on the host to have nice messages. People committing tasks on a branch may not have good commit messages, and that's fine, but if the branch needs to be merged, these commits with unclean messages go to master.

One way to solve this problem is to always merge to deal with -squash. Thus, you get the opportunity to send a message with a good message and process the entire range of commits as one. I am wondering if there is a way to provide this? value, if we can let the git server reject merges that are not crushed?

+3
source share
3 answers

Until it is forced directly, you can set --squashas the default join parameter for branching master:

git config branch.master.mergeoptions  "--squash"

This will always give out commits that will be merged into a master, without specifying an option --squash.

+8
source

, , , , - , . , -. , , ..

+1

You can use it rebase -iin your branch, which will allow you to essentially squeeze all the commits on the branch into 1 commit, and then merge this branch (1 commit) into the master.

0
source

All Articles