Git don’t allow us to merge with local modifications. Git protects from losing potentially important changes.
There are 3 options
1. commit the changes using
git commit -m “my changes that needs a commit and should not be reverted“
2. Stashing
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
for e.g.
git stash
git pull (or) switch branch
git stash apply --index
3. Discard the local changes
using git reset --hard. or git checkout -t -f remote/branch
Discard local changes for a specific file
git checkout filename
references:
http://stackoverflow.com/questions/15745045/how-do-i-resolve-git-saying-commit-your-changes-or-stash-them-before-you-can-me
There are 3 options
1. commit the changes using
git commit -m “my changes that needs a commit and should not be reverted“
2. Stashing
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
for e.g.
git stash
git pull
git stash apply --index
3. Discard the local changes
using git reset --hard. or git checkout -t -f remote/branch
Discard local changes for a specific file
git checkout filename
references:
http://stackoverflow.com/questions/15745045/how-do-i-resolve-git-saying-commit-your-changes-or-stash-them-before-you-can-me
No comments:
Post a Comment