I'm working on a separate branch for a feature.
Now I want this feature in my main branch, but just having all the commits squashed to a single one (with a recap into the commit message).
The thing is that I already push
ed the branch to remote
.
So I'm not sure if I can perform a git merge --squash feature
(from the main branch) or if that could rewrite my git history.
I don't get if git merge --squash
will just create a new commit (containing, as a patch, all the changes of my merged branch. So in a safe way), or if it will remove the old commits from my branch or just do any alteration to the git history. (I want to avoid that cause I work in team).
Should I maybe opt for a commit-range cherry-pick
, instead of a git squash
? (but the cherry-pick would just copy all the commits without squashing them)
Or merging with squash is fine? (even after a push to the remote feature-branch)