我有一个仓库与谷歌硬盘同步,但我忽略了.git目录,因此它现在被上传到Google Drive。克隆git仓库的.git目录
最近我对自己的Gentoo
机器进行了格式化,当我将所有Google Drive文件再次同步后,我意识到.git
目录不存在。
问题是我不记得我是否在本地没有推送到github的一些不加标签/无法完成的更改。
我一直在寻找,但我只找到了相反的问题答案(克隆无.git
目录)
- How do I clone a subdirectory only of a Git repository?
- Cloning only a subdirectory with git
- How to clone git repository only some directories?
- Is it possible to clone only part of a git project?
- Git Clone: Just the files, please?
- Git clone without .git directory
我不想让我的回购的git clone
直到我确信,可能局部变化都不会亏。
有没有克隆只有.git
文件夹的任何方法,然后推我可能在我的机器上的任何本地更改?
这个方法唯一的问题是你没有机会签出特定的分支,而默认的克隆会检出'master'分支,这不是你可能想要比较你的本地文件集针对 – g19fanatic
由于您只需要.git文件夹而不是整个工作目录,因此请确保使用--bare选项克隆它。 –