我的初始提交包含一些日志文件.我已添加*log到我的.gitignore,现在我想从我的存储库中删除日志文件.
git rm mylogfile.log
Run Code Online (Sandbox Code Playgroud)
将从存储库中删除文件,但也将从本地文件系统中删除它.
如何在不删除文件的本地副本的情况下从存储库中删除此文件?
我正在尝试向我的git repo添加一个子模块,我收到了这个错误:
remote origin does not have a url defined in .git/config
Run Code Online (Sandbox Code Playgroud)
关于这可能是什么的任何想法?我试着谷歌搜索它,但只有一个模糊的链接出现.
我这样做:
git submodule add ../extern/Lib1 lib
Run Code Online (Sandbox Code Playgroud)
我期待这个创建一个子模块lib/Lib1
我知道这只会创建一个引用,然后我必须更新/ init(在这部分不是很清楚,没有那么远;我只是在学习子模块命令).
我有一个git repo,我想为它添加一个子模块.问题是,子模块作为另一个仓库内的文件夹存在.我可以只将该文件夹添加为子模块吗?
可能非常愚蠢的问题, - 但我一直在.gitmodules文件中指定子模块.最近让我感到震惊的是,也许有可能只是因为同样的原因使用.git/config,所以我不必在工作目录中保留无关的文件?
.git/config:
[submodule "path/to/repo"]
url = git@github.com:username/repo.git
Run Code Online (Sandbox Code Playgroud)
.gitmodules
[submodule "path/to/repo"]
path = path/to/repo
url = git@github.com:username/repo.git
Run Code Online (Sandbox Code Playgroud)
这些基本上是一样的吗?
我正在尝试安装utilsnips.
当我输入:
cd ~/.vim/
git submodule add https://github.com/SirVer/ultisnips bundle/ultisnips
Run Code Online (Sandbox Code Playgroud)
我收到这条消息:
You need to run this command from the toplevel of the working tree.
Run Code Online (Sandbox Code Playgroud)
为什么?我怎么能避免呢?