So I want to merge the different branch into my branch and also I really do not care around those documents if they are no much longer ignored or not.

You are watching: The following untracked working tree files would be overwritten by checkout:

But i am facing listed below error:

The adhering to untracked functioning tree files would be overwritten through merge

How deserve to I change the traction command come overwrite the files, there is no me needing come find, move or delete the records by myself?


*
askedDec 27, 2019alecxe7.5k points

Solution :

I had actually the very same issue and also tried every the remedies which ns knew, and also neither of them operated actually after long research I discovered the solution for the error together below:

The trouble with your branch is the you are not tracking your files locally however the identical papers are acquiring tracked remotely therefore in stimulate to be able to "pull" the device need come be required to overwrite your local documents which room not the version controlled.

So shot running below commands :

git include * git stashgit pullAfter executing all over commands it will certainly track all your files and remove all of your local transforms to those files and after the it will gain the records from your server.


*
answeredDec 27, 2019AbhijitJ38.6k points
ask associated questioncomment

Your comment on this answer:

Your surname to display screen (optional):
Email me in ~ this address if a comment is added after mine:Email me if a comment is included after mine

Privacy: your email deal with will only be offered for sending these notifications.
Anti-spam verification:

What is the color of the sky?
To stop this confirmation in future, you re welcome log in or register.
Add commentCancel

0 votes

Solution:

The problem is that you space not folowingthe records locally howeveridentical papers are follwedremotely so in order to "pull" your device would be compelled to overwrite the local papers which are not variation controlled.

Attempt running

git include * git stashgit pullThis will certainly followall files, dispelall of her local alters to those files, and then findthe files from the server.

You have the right to attemptcommand to clear the untracked files from the local

Git 2.11 and also newer versions:

git clean -d -f .Older version of Git:

git clean -d -f ""Where-dcan be changed with the following:

-xignored documents are additionally dispelas well as records unknown come Git.

-ddispeluntracked directories in enhancement to untracked files.

-fis necessaryto force it to run.

The only commands that performedfor me were:

git bring --allgit reset --hard origin/your branch nameA replacement forgit mergethat will certainly overwrite unfollwedfiles

The comments listed below conduct'FOI' because that the 'files that interest', the documents that

subsist in the donor branch,

do not exist in the takingbranch,

and room blocking the merge causethey are present and untracked in your functioning directory.

git checkout -f donor-branch # replace FOI v tracked `donor` versionsgit checkout receiving-branch # FOI room not in `receiving`, therefore they disapppeargit unify donor-branch # currently the merge worksA replacement forgit pullthat will certainly overwrite unfollwedfiles

pull = bring + merge, hencewe dogit fetchfollowed by thegit checkout -f, git checkout, git mergetrick above.

git fetch origin # fetch far commitsgit checkout -f origin/mybranch # replace FOI with tracked upstream versionsgit checkout mybranch # FOI are not in mybranch, therefore they disapppeargit merge origin/mybranch # now the merge works. Bring + merge completes the pull.Elaborated explanation

git merge -fdoes not exist, butgit checkout -fdoes.

We will employgit checkout -f+git checkoutto dispelthe files Of attention , and also then your merge deserve to passnormally.

Step 1.This step perforcereplaces untracked FOI v tracked version of the donor branch (it additionally checks out the donor branch, and also updates the rest of the functioning dir).

git checkout -f donor-branchStep 2.This action dispelsthe FOI causethey they room tracked in our existing (donor) branch, and inexistentin thereceiving-branchwe move to.

See more: Eat I Ate A Bowl Of Nails For Breakfast (Without Any Milk), Welcome To The Salty Spitoon

git checkout receiving-branchStep 3.Now that the FOI are inesixtent, merger in the donor branch will not overwrite any untracked files, therefore we gain no errors.