如何重命名git根文件夹? [英] How to rename git root folder?

查看:195
本文介绍了如何重命名git根文件夹?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚开始在Vista中使用git,我的存储库位于 / path / to / project / git repo 下。



我现在发现文件夹名称中的空间在使用git bash时是一个小问题。



我可以将文件夹重命名为 /路径/到/项目/ gitrepo ?是否一切都在git配置相对,还是有什么明确指向父文件夹?



我试过只是采取主文件夹的Windows副本,和运行git bash,'git log'显示我之前做过的更改。所以我假设重命名主文件夹是确定的,但我想确定之后再继续。

稍微修改 Greg answer ,是的,所有使用git repo的东西都是相对于 .git 父目录而言的, p>

(并且这可能不会直接影响到您,我只是为了完整性而提及这些原因):


  • repo本身的路径可以被计算机上运行的其他服务引用(Apache,ssh,另一个repo将您的repo声明为远程,使用完整文件路径, gitolite 图层在特定路径中声明您的回购,...)

  • 一些操作使用回购的完整路径(如 GIT_INDEX_FILE usin例如,在过滤器分支命令中,请参阅 this thread ),显然,执行时不要重命名根目录一个复杂的操作您的回购。


另外,一个windows副本(而不是 git克隆)将会复制包括钩子在内的所有东西,如果你已经编辑了它们并进行了修改,那么它们可能包含绝对路径。


I've just started using git in Vista, with my repository under /path/to/project/git repo.

I've now found that the space in the folder name is a minor irritation when working in git bash.

Can I just rename the folder to /path/to/project/gitrepo? Is everything within the git config relative, or is there anything that explicitly refers to the parent folder?

I've tried just taking a windows copy of the main folder, and run git bash on that, and 'git log' shows the changes I had previously made. So I assume renaming the main folder is OK, but I'd like to be sure before I go any further.

解决方案

To amend slightly Greg's answer, yes, everything with a git repo is relative to the .git parent directory, but:

(and this won't probably affect you directly, I only mention those reasons here for completeness' sake.):

  • the path of the repo itself could be referenced by other services running on your computer (Apache, ssh, another repo declaring your repo as a remote, using the full file path, a gitolite layer declaring your repos in a certain path, ...)
  • some operations use the full path of the repo (like the GIT_INDEX_FILE using within a filter-branch command for instance, see this thread), so, obviously, don't rename the root directory while performing a complex operation on your repo.

Plus, a "windows copy" (instead of a git clone), will copy everything including hooks, which may include absolute path in their script if you have edited them and made those kind of modification.

这篇关于如何重命名git根文件夹?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆