【发布时间】:2016-11-27 23:09:26
【问题描述】:
我不知道怎么做,但我不知何故把一个文件变成了一个子模块。所以现在我无法在 Github 中查看它。如何撤消此操作以使文件再次可点击?
(我已经阅读了stackoverflow中类似问题的答案,它们对我来说没有多大意义......我对git很陌生)
【问题讨论】:
标签: github
我不知道怎么做,但我不知何故把一个文件变成了一个子模块。所以现在我无法在 Github 中查看它。如何撤消此操作以使文件再次可点击?
(我已经阅读了stackoverflow中类似问题的答案,它们对我来说没有多大意义......我对git很陌生)
【问题讨论】:
标签: github
您要么需要revert to a past commit where that file was not a submodule:
git log path/to/file
git checkout <past_commit> -- path/to/file
或者您可以删除该条目并恢复文件,添加并再次提交。
git rm -- path/to/file
# copy the file
git add -- path/to/file
git commit -m "restore file"
【讨论】: