DEV Community

Discussion on: GIT Mantras you should know

Collapse
 
kkpoon profile image
kkpoon • Edited

The merge commit isn’t useless. It helps you brings the changes in, without changing the commit hash of any single commit. This gives you possibility to undo the merge by just remove the Merge Commit.

While using rebase, and mistake was made during rebase. It is more difficult to undo and redo.

With the branch you are working on, has a lot of commits, using git pull --rebase would also trigger conflict resolve for each commit. It is quite annoying.

I would suggest keep git pull origin master, and perform one time git rebase to squash them all when ready to merge into main branch.

Collapse
 
andreacanton profile image
Andrea Canton

Good point! But in my experience, in most cases, I'm trying to push a single or two commits and there aren't conflicts, so the merge commit is identical to the commit(s). If the rebase is too large or full of conflicts you can simply send a git rebase --abort and do the merge instead.

Thank you for sharing!!!