Mona Jalal
Mona Jalal

Reputation: 38145

error: Your local changes to the following files would be overwritten by merge:

I am not sure how to get rid of this error. I am using "bitbucket" to privately upload my projects but I am receiving the following error even though I have deleted all the changed files. I simply want to pull the files

error: Your local changes to the following files would be overwritten by merge:
    buf.cpp
    buf.h
Please, commit your changes or stash them before you can merge.
Aborting

This is the command I used:

git pull origin

Upvotes: 4

Views: 29786

Answers (4)

Juggan
Juggan

Reputation: 1

Simply delete update_dart_sdk.ps1 from flutter src\flutter\bin\internal then use flutter stable channel

Upvotes: -2

Kabir Hossain
Kabir Hossain

Reputation: 3105

You can either commit your changes before you do the merge, or you stash them:

git stash save
git pull
git stash pop

Then, add your changes and push to master:

git add .
git commit -m 'your message'
git push -u origin master

This will help you working even in a team.

Upvotes: 7

kenorb
kenorb

Reputation: 166319

Try adding -r, e.g.:

git pull origin -r

which will rebase your changes on top of the upstream.

See also: How do I resolve git saying "Commit your changes or stash them before you can merge"?

Upvotes: 1

Tonio
Tonio

Reputation: 1546

Deleting a file is changing it. You want those two files to be "unchanged". If you want to keep any changes you've done (including deletion), you should either stash or commit. Stashing would require unstashing (git stash pop or git stash apply), while committing will probably result in a conflict which you must resolve. If you just want to revert any changes (throw them away, not interested in keeping them), you can git checkout -- buf.cpp buf.h to restore them, then try the pull.

Upvotes: 3

Related Questions