Git solves pull origin error: the following untracked working tree files would be rewritten by merge

error: The following untracked working tree files would be overwritten by merge:

bin/AndroidManifest. XML

Please move or remove them before you can merge.

Aborting

scheme 1:

git clean-d-fx “”

one of them

x — deleting ignored files is no longer recognized by git

d — deletes files not added to git’s path

F — Forced operation
Scheme 2:

The following error occurred in git pull on the server today:
error: Your local changes to the following files would be overwritten by merge:
application/config/config. PHP
application/controllers/home. PHP
Please, commit your changes or stash them before you can merge.
Aborting
I do not know what causes the code conflict, the solution is as follows:
If you want to keep the changes made on the production server, simply incorporate the new configuration item:
git stash
git pull
git stash pop
You can then use Git diff-w + file names to verify that the code is automatically merged.
If you want to completely overwrite the local working version with files from the code base, do so as follows:
git reset –hard
git pull

Solution 3:

Problem 1: Fix GIT repositories that are out of sync
Appear today when performing git pull:

 
    [root@gitserver /data/work/www/rest/lib/Business/Inventory]# git pull  Enter passphrase for key '/root/.ssh/id_rsa':  Updating 70e8b93..a0f1a6c  error: Your local changes to the following files would be overwritten by merge:          rest/lib/Business/Inventory/ProductStatus.php  Please, commit your changes or stash them before you can merge.  Aborting 

The solution :
executes git checkout-f, and then pulls git checkout again

 
    [root@gitserver /data/work/www/rest/lib/Business/Inventory]# git checkout -f  Your branch is behind 'origin/master' by 2 commits, and can be fast-forwarded. 

When git pull is performed, it is ready:

 
    [root@gitserver /data/work/www/rest/lib/Business/Inventory]# git pull  Enter passphrase for key '/root/.ssh/id_rsa':  Updating 70e8b93..a0f1a6c  Fast-forward  rest/lib/Business/Inventory/ProductStatus.php |    1 +   1 files changed, 1 insertions(+), 0 deletions(-)   mode change 100644 => 100755 rest/lib/Business/Inventory/ProductStatus.php 

 
Second problem: the default location of Git Pull.
1. When Git is under the branch of master, the default remote is origin;
2. When using git pull under the master brach, specify remote and merge, use the default remote and merge.

but for your own project, and push to the remote server, there is no such thing, you need to configure yourself.
if you directly run git pull, you will get the following results:
Tips after executing Git Pull:

 
    $ git pull  Password:  You asked me to pull without telling me which branch you  want to merge with, and 'branch.master.merge' in your configuration file does not tell me, either. Please  specify which branch you want to use on the command line and try again (e.g. 'git pull <repository> <refspec>').  See git-pull(1) for details.     If you often merge with the same branch, you may want to use something like the following in your configuration file:     [branch "master"]   remote = <nickname>   merge = <remote-ref>     [remote "<nickname>"]   url = <url>   fetch = <refspec>     See git-config(1) for details. 

The solution is to configure git Config as follows.

 
    git remote add -f origin [email protected]:rest.git  git config branch.master.remote origin  git config branch.master.merge refs/heads/master 

Plan 3 from “ritto ‘s blog” blog, please be sure to keep this from http://ritto.blog.51cto.com/427838/741342

Read More: