Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

git merge fails refusing to lose untracked file

Tags:

git

I am trying to merge a repository on the master. I am getting the following error.

error: refusing to lose untracked file at 'config/database.yml'

git status gives me

deleted by us:   config/database.yml

How can I resolve that ?

like image 457
user3814030 Avatar asked Oct 07 '15 15:10

user3814030


People also ask

How do I keep my git files untracked?

You have to add the untracked files of the repository by using the “git add” command and run the “git stash” command to save the untracked file and clean the current directory for working by removing the untracked file from the repository folder.

What are untracked files in git?

Untracked files are files that have been created within your repo's working directory but have not yet been added to the repository's tracking index using the git add command.

Does git pull affect untracked files?

@AayushNeupane git is not going to do anything with untracked files, they are untracked means git is not tracking them, so no git command can do anything to the untracked files.


1 Answers

From what you're describing, the database.yml file just shouldn't be in your repository anymore.

Perform git rm --cached config/database.yml to remove it from Git, then attempt your merge once more.

like image 152
Makoto Avatar answered Sep 24 '22 14:09

Makoto