Git - Cherry Picking Changes but Avoid Taking the Exact Commit Log

03/10/2022, Thu
Categories: #git

Customize the cherry-picked Commit Message

You are working on a branch focusing on a certain feature, but you end up adding in commit messages that are not presentable enough to be applied to your main branch. To fix this problem, you can rebase to squash the commits and then cherry-pick the changes onto the main branch.

First, squash the commits in the feature branch and then switch to your main branch.

Cherry-pick the changes, but use the n option when selecting the hash from the feature branch to apply the changes.

git cherry-pick -n <HASH>

Now you can add a commit message of your choice for a cleaner commit log.