[英]Change the GIT root directory on a Windows computer
I installed GIT on my windows computer a few days ago, and set the root directory to my user's folder ( c:/users/user
). 几天前,我在Windows计算机上安装了GIT,并将根目录设置为用户的文件夹(
c:/users/user
)。 It added some folders and files (such as .git
and .gitconfig
) to the user's folder and creates a bloated folder. 它将一些文件夹和文件(例如
.git
和.gitconfig
)添加到用户的文件夹中,并创建了一个.gitconfig
肿的文件夹。
Now I'm interested in changing the root folder to an inner folder (which I'll name Programming). 现在,我有兴趣将根文件夹更改为内部文件夹(我将其命名为Programming)。
Can I change the root directory without harming the repositories I already have? 我可以更改根目录而不损害已经拥有的存储库吗? How can I do this from the console?
如何从控制台执行此操作?
You can leave the .gitconfig in place (it is your global Git configuration) 您可以保留.gitconfig到位(这是您的全局Git配置)
But a .git
subfolder means you have initialized a repository in c:/users/user
(as in " git init .
"). 但是
.git
子文件夹意味着您已经在c:/users/user
初始化了一个存储库(如“ git init .
”中)。
If you have added and committed all the files you need, you can: 如果已添加并提交了所需的所有文件,则可以:
c:/users/user/.git
in that new folder c:/users/user/.git
复制到该新文件夹中 git checkout HEAD -- .
git checkout HEAD -- .
c:/users/user/.git
That would move that repo in the new folder, and recreate its content. c:/users/user/.git
这将在新文件夹中移动该存储库,并重新创建其内容。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.