git:如何将外部目录添加到存储库? [英] git: How do you add an external directory to the repository?
问题描述
外部目录:
/ home / some /目录
工作目录:
/htdocs/.git
如果我从/ htdocs目录尝试以下命令:
git add / home / some / directory
我得到一个错误:
致命:'/ home / some / directory'在外部存储库
做这样的事情,我通常会将该外部文件或目录移动到我的git repo中,并将它的原始位置符号链接到新的位置。
mv / home / some / directory / htdocs /目录
ln -s / htdocs / directory / home / some /
git add ./directory
当我为一个应用程序开发一个插件时,我使用这种技术,该应用程序需要在版本控制下保存,但必须存储在特定位置。 / p>
I want to add an external directory to an existing repository.
External Dir: /home/some/directory
Working Dir: /htdocs/.git
If I attempt the following command from the /htdocs dir:
git add /home/some/directory
I get an error: fatal: '/home/some/directory' is outside repository
If I need to do something like that I would normally move that external file or directory into my git repo and symlink it's original location to the new one.
mv /home/some/directory /htdocs/directory
ln -s /htdocs/directory /home/some/
git add ./directory
I use this technique when I am developing a plug-in for an application that I want to keep under version control but have to store in a specific location.
这篇关于git:如何将外部目录添加到存储库?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!