-1

The remote repository is a newer version than my local repository, and I have made changes to my local repository. How do I merge the two? When I try to do "git pull origin master", it gives me a "commit your changes or stash them" error.

Is there anyway to merge easily?

1 Answers1

2

You have a few options:

  1. If you're done with your local changes, go ahead and commit them. Then, when you do git pull origin master, the git will merge the remote changes with your local ones, or ask you to merge manually if it cannot.

  2. If you're not quite done with what you're working on locally, you can do a git stash, which "stashes" your changes away temporarily. Once you do that, you can do git pull origin master, then reapply your changes using git stash pop. Again, if there are any merge conflicts, you will need to handle them yourself.

  3. If you're OK with tossing out your local changes, do git checkout . and then pull down from remote. Needless to say, you will lose whatever you were working on locally.

bmat
  • 2,084
  • 18
  • 24