好的,所以我有以下分支:
git branch
2012-08-06-AAH
2012-08-06-JWH
2012-08-06-Master
* master
我想 checkout 到 2012-08-06-AAH
。所以我这样做:
git checkout 2012-08-06-JWH
error: Your local changes to the following files would be overwritten by checkout:
MyProject/canada/rocky_mountaineer/best/coast_to_coast_rail/index.html
MyProject/europe/train_tours/scenic_europe/index.html
MyProject/europe/train_tours/springtime_alps/index.html
MyProject/europe/train_tours/week_in_spain/index.html
MyProject/europe/train_tours/windmills_vineyards_paris/index.html
MyProject/europe/train_tours/wonderful_france/index.html
MyProject/europe/train_tours/wonders_st_petersburg_moscow/index.html
Please, commit your changes or stash them before you can switch branches.
Aborting
好的...很公平。所以我这样做:
git status
# On branch master
nothing to commit (working directory clean)
嗯...那么如果没有什么可提交的,我该如何“提交您的更改或存储它们”?
感谢您的帮助 - 我是一个 Git 新手(主要使用 Tower,GUI 客户端),当我失败时,我求助于命令行。
最佳答案
如果您确定没有对这些文件进行任何本地修改,您可以尝试
git checkout -- .
这会将工作树重置为 HEAD,并且应该允许继续进行 checkout 。
关于Git 不允许我将分支切换为 "changes to the following files would be overwritten",但是,git-status 显示没有任何变化,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12018098/