When we have committed local changes in a repo that have not been published, the right thing is to do a git pull --rebase
to integrate them with upstream. This results in a clean, linear log. If we do a git pull
, we get ugly merges, as git keeps our commits exactly the same in a kind of side branch, and automatically applies additional changes to integrate them. These merges are unnecessary, since the changes were never published and do not have to be preserved in the same form with the same SHA hashes. It's better if they are in a nice straight line of development with upstream.
Is there an easy way to undo to the effect of git pull
and then re-do it with git pull --rebase
?
Preventively, is there a way to get git pull
to require an explicit --no-rebase
or --rebase
in order to proceed, when there are local commits, instead of assuming a default which may be wrong?