英文:
Untracked files prevent checkout
问题
在我的IntelliJ项目中,我检出了旧版本的分支,以查看那里的某些操作是如何完成的。我没有进行任何更改,但现在当我想要切换回主分支时,我收到了以下消息:未跟踪的文件阻止了切换。起初,只显示了后来版本中添加到项目中的新的webdriver文件,但现在在执行git status
命令后,它显示了所有在后来版本中添加的类。发生了什么?我如何跳过它并返回主分支,而不破坏我的项目?
英文:
In my project under IntelliJ I checkout branch with old version in order to seee how something was done there. I didn't change antyhing and now when I want to return to master I receive this message:
Untracked files prevent checkout. Firstly there were only new webdriver file shown which was added to project in later version but now after executing command git status
it shows all the class which were added in later version.
What happend ?
How can I skip it and return to master without breaking my project ?
答案1
得分: 1
如果你不需要保留旧分支上的任何更改,你可以强制切换到主分支。
git checkout -f 分支名
编辑:我不使用IntelliJ,所以无法提供相关建议。打开一个终端,进入你的git项目目录,然后运行上述命令。
英文:
If you don't have any changes that you want to keep for the old branch, you can force checkout to master.
git checkout -f BRANCH-NAME
Edit: I do not use IntelliJ so I can't advise for that. Open a terminal, navigate to your git project and run the above command.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论