Please move or remove them before you can merge.
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
The following error occurred in git pull on the server today:
error: Your local changes to the following files would be overwritten by merge:
Please, commit your changes or stash them before you can merge.
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 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
Problem 1: Fix GIT repositories that are out of sync
Appear today when performing git pull:
[[email protected] /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
[[email protected] /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:
[[email protected] /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
- Error: You have not concluded your merge (MERGE_HEAD exists)
- Please specify which branch you want to merge with
- How to Fix GIT Push Error
- Error: your local changes to the following files would be rewritten by merge solution
- [Git] git pull pull remote git push to remote git commit submit reject
- Error: failed to push some refs to ‘xxx’
- Git failed to submit data error: failed to push some refs to’https://github.com/XXXXXXX/gif.git’
- [Git & GitHub] Solution: error: failed to push some refs to’https://github.com/xxxx.git’
- Git stash temporary storage recovery and file deletion recovery
- Pull is not possible because you have unmerged files. Please, fix them up in the work tree, and then
- git push error failed to push some refs to solution
- Git push you are not allowed to upload merges
- You need to resolve your current index first
- Git error: requested URL returned error: 403
- Solve github :error: failed to push some refs to problem
- pathspec ‘master’ did not match any files known to git
- error: src refspec master does not match anyerror: failed to push some refs to
- Git Pull Failed solution
- Git pull undo misoperation