我的Java项目中有2个分支:master和refactor。我已经完成了对refactor的工作,现在想要checkout master
并将refactor合并到master中。在进行refactor时,我还将一些文件添加到了.gitignore中(其中一个是.idea),现在我得到了以下提示:
[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
我已经阅读了很多帖子,但是没有任何作用。怎样可以在不访问主分支的情况下删除这些文件?有什么办法可以解决这个问题吗?如果您能,可以提供cmd命令。我还是Git新手。
以下是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)