• Register
0 votes
2.2k views

Problem :

I made some of the updates on my local machine, pushed them to the remote repository, and now I want to pull my changes to the server and I get a message;

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

wp-content/w3tc-config/master.php

Please, commit your changes or stash them before you can merge.

So I ran the below command,

git checkout -- wp-content/w3tc-config/master.php

And tried again and I got a same message. I am assuming that the w3tc changed something in a config file on a server. I don't care whether a local copy or remote copy goes on a server (I suppose a remote one is the best), I just want to be able to merge a rest of my changes (plugin updates).

Any clues how can I resolve it?

7 5 2
3,870 points

Please log in or register to answer this question.

1 Answer

0 votes

Solution :

You can not  merge with your local modifications. Git protects you from losing the potentially important changes.

You have below three options:

· Commit your change using

git commit -m "My message"

· Stash your change using.

Stashing acts as the stack, where you can push the changes, and you pop them in a reverse order.

To stash it, type

git stash

Do a merge, and then pull a stash:

git stash pop

· Discard your local changes

using the git reset --hard
or the git checkout -t -f remote/branch

Or: Discard your local changes for the specific file

using the git checkout filename

9 7 4
38,600 points

Related questions

0 votes
1 answer 20 views
20 views
Problem: I need your help: Please commit your changes or stash them before you switch branches. aborting
asked Mar 14 Wafa Abu Yousef 6.1k points
0 votes
1 answer 32 views
32 views
Problem: Can anyone tell me the solution of this problem? please, commit your changes or stash them before you can switch branches.
asked Mar 23 Ifra 37.2k points
0 votes
1 answer 42 views
42 views
Problem: I need someone to understand this problem and find out the solution. Thanks please, commit your changes or stash them before you can merge. aborting
asked Mar 23 Ifra 37.2k points
0 votes
1 answer 43 views
43 views
Problem: please commit your changes or stash them before you merge.
asked Feb 19 Dan phillip 4.8k points
1 vote
1 answer 29 views
29 views
Problem: How can I deal with this problem : please move or remove them before you switch branches.
asked Apr 2 MUHAMMAD MUNEEB 83k points
0 votes
1 answer 8 views
8 views
Problem: Can anyone tell me the solution of this problem? Please enter commit message for your changes
asked Apr 25 Ifra 37.2k points
0 votes
1 answer 7 views
7 views
Problem: I need someone’s assistance to solve my problem .. If you want to see the changes since last commit in a specific file, what command should you use?
asked Apr 7 Ifra 37.2k points
1 vote
1 answer 27 views
27 views
Problem: Any one here who can solve this issue please? Fatal: working tree contains unstaged changes. aborting.
asked Apr 18 PkGuy 23.5k points
0 votes
1 answer 6 views
6 views
Problem: Is there anyway to override the behavior so it doesn't error out when name and email are not set?
asked Apr 19 anika11 32.2k points
0 votes
1 answer 8 views
8 views
Problem: What am I supposed to do here? >Please clean your repository working tree before checkout.
asked 3 days ago Florina Gulnar 6.7k points