I have a bare repo and a working repo on my server.
I want to get rid of a file as it is causing me problems:
error: Untracked working tree file 'web/source/php/class.DBCredentials.php' would be overwritten by merge. Aborting
I it is in my .gitignore in my working directory and that is why it is un-tracked.
I'm trying to run a git pull from my bare repo.
the file is already present in the to-be-merged branch.
this branch can also be the upstream/master
(fetched from the bare repo), which you are trying to merge into your local master
(in your working repo).
the very simple solution to the problem is:
move your local file out of the way
mv web/source/php/class.DBCredentials.php web/source/php/class.DBCredentials.php.bak
merge your local branch with the upstream branch
remove the offending file
git rm web/source/php/class.DBCredentials.php
git commit
push to upstream
restore the file
mv web/source/php/class.DBCredentials.php.bak web/source/php/class.DBCredentials.php
let .gitignore
do the rest.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.