未跟踪的文件阻止检出。

huangapple go评论75阅读模式
英文:

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.

huangapple
  • 本文由 发表于 2023年4月4日 16:44:09
  • 转载请务必保留本文链接:https://go.coder-hub.com/75927274.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定