我有一個倉庫與谷歌硬盤同步,但我忽略了.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選項克隆它。 –