I have 2 branches in my Java project: master and refactor. I've finished working on refactor so now would like to checkout master
and merge refactor into master. While working on the refactor, I also added some files to .gitignore (one of them was .idea) and now I get:
[michal@michal-pc MCleaner]$ git checkout master
error: The following untracked working tree files would be overwritten by checkout:
.idea/description.html
.idea/misc.xml
.idea/modules.xml
.idea/project-template.xml
.idea/vcs.xml
Please move or remove them before you switch branches.
Aborting
I've read many posts and nothing works. How can I remove those files without accessing master branch? Is there a way to fix that? Please provide cmd commands if you can, I'm still new to git.
Here is the output from git status
:
On branch refactor
Your branch is up-to-date with 'origin/refactor'.
Untracked files: (use "git add <file>..." to include in what will be committed)
.idea/
target/
nothing added to commit but untracked files present (use "git add" to track)
Add the following to .gitignore
.idea
and remove this directory
git rm -r .idea
Then commit changes.