git rebase --continue vs. new commit

1.2k views Asked by At

If I run into merge errors, I usually solve the merge errors, add my files again and use git rebase --continue
to continue with pulling and pushing.

Now I had some time to take a deeper look into how git works and figured out, that it should be possible to create a new commit instead. I think, thats maybe a good idea to clarify that there were some merge errors and that they were solved manually.

So which one is recommed to use and what are their both advantages and disadvantages? Thanks in advance!

2

There are 2 answers

1
Matthew Strawbridge On BEST ANSWER

Just use git rebase --continue. Resolving conflicts is an expected part of rebasing. You're throwing away the old commit that actually caused the conflict, so I don't see any benefit in recording its resolution separately.

0
bcmcfc On

To add to the other answer, your two options are rebase and merge.

Rebase is good when you're working alone on a feature, or specifically need to be replaying your changes ontop of the latest master.

Merge is good when you're working with other people, as rebasing rewrites the history and makes that collaboration difficult or downright impossible.

A quick rebase (git pull --rebase) is also handy if your changes are frequently pushed (as are those of other people) and you want to ensure your git history is cleaner and easier to follow in visual tools such as gitg or the git log --graph view.