Created
May 24, 2017 01:56
-
-
Save cyberfly/515b8ad70b3ea6ece0a991c19e4b0464 to your computer and use it in GitHub Desktop.
How do I resolve git saying “Commit your changes or stash them before you can merge”? https://stackoverflow.com/a/15745424/417899
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
You can't merge with local modifications. Git protects you from losing potentially important changes. | |
You have three options. | |
1. Commit the change using | |
git commit -m "My message" | |
2. Stash it. | |
Stashing acts as a stack, where you can push changes, and you pop them in reverse order. | |
To stash type: | |
git stash | |
Do the merge, and then pull the stash: | |
git stash pop | |
3. Discard the local changes | |
using git reset --hard. or git checkout -t -f remote/branch | |
3. a) Discard local changes for a specific file | |
using git checkout filename |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment