- If local work is uncommitted
- And you've introduced completely new files that don’t exist in the remote branch:
- Or the files affected by your local work have ZERO overlap with the files affected by the changes you need to pull from the remote:
- You're in luck:
git pull
will "just work"
- Otherwise:
- If your local changes have NO overlap with changes you are pulling:
- git stash will work:
git stash save
git pull
git stash pop
- If your local changes have SOME overlap with changes you are pulling:
- git stash will require manual conflict resolution:
git stash save
git pull
git stash pop
- resolve merge conflicts
git reset
git stash drop
- If local work is committed
- And the files affected by your local work have ZERO overlap with the files affected by
- You're in luck:
git pull
will "just work"
- However:
git pull --rebase
will "work even better" because of a cleaner history
- there is no merge commit; your changes will be committed after upstream changes
- Otherwise:
- git pull will require manual conflict resolution:
git pull
- resolve merge conflicts
git add FILE
for each conflicting FILE
git commit
git pull --rebase
could still "work even better" because of a cleaner history
- however, resolving merge conflicts could be much harder
For a detailed explanation, please see: https://happygitwithr.com/pull-tricky.html