我似乎无法摆脱Git子模块中未跟踪的内容.运行git status收益率:
# On branch master # Changes not staged for commit: # (use "git add ..." to update what will be committed) # (use "git checkout -- ..." to discard changes in working directory) # (commit or discard the untracked or modified content in submodules) # # modified: bundle/snipmate (untracked content) # modified: bundle/surround (untracked content) # modified: bundle/trailing-whitespace (untracked content) # modified: bundle/zencoding (untracked content) # no changes added to commit (use "git add" and/or "git …
有些人(我认为在1.6.x版本附近)git意识到了子模块内部的变化.那只会让我烦恼:
$ git status vendor | grep modified: # modified: vendor/rails (modified content)
$ git diff vendor/ diff --git a/vendor/rails b/vendor/rails --- a/vendor/rails +++ b/vendor/rails @@ -1 +1 @@ -Subproject commit 046c900df27994d454b7f906caa0e4226bb42b6f +Subproject commit 046c900df27994d454b7f906caa0e4226bb42b6f-dirty
请停止?
好的,我有答案.现在我有另一个问题:
我可以把它放进去~/.gitconfig吗?从我最初看起来我不能,并且我没有看到任何有希望通过略读补丁.(我想我仍然可以做别名.)
在Linux上使用Git 1.8.1.1.存储库如下所示:
master
book
Run Code Online (Sandbox Code Playgroud)
子模块创建如下:
$ cd /path/to/master
$ git submodule add https://user@bitbucket.org/user/repo.git book
Run Code Online (Sandbox Code Playgroud)
该book子模块是干净的:
$ cd /path/to/master/book/
$ git status
# On branch master
nothing to commit, working directory clean
Run Code Online (Sandbox Code Playgroud)
另一方面,主人显示书子模块有"新提交":
$ cd /path/to/master/
$ git status
# On branch master
# Changes not staged for commit:
# (use "git add <file>..." to update what will be committed)
# (use "git checkout -- <file>..." to discard changes in working directory)
#
# modified: book (new …Run Code Online (Sandbox Code Playgroud) 这就是我git status的结果:
# On branch master
# Changed but not updated:
# (use "git add <file>..." to update what will be committed)
# (use "git checkout -- <file>..." to discard changes in working directory)
# (commit or discard the untracked or modified content in submodules)
#
# modified: vim/bundle/pathogen (modified content)
# modified: vim/bundle/sparkup (untracked content)
#
no changes added to commit (use "git add" and/or "git commit -a")
Run Code Online (Sandbox Code Playgroud)
跑步git diff vim显示这个:
diff --git a/vim/bundle/pathogen b/vim/bundle/pathogen …Run Code Online (Sandbox Code Playgroud) 我使用病原体来组织我的vim插件.我git将插件从github克隆到vimbundles目录中.这样,更新它们很简单.
我对病原体产生的标签有问题.如果插件没有在其代码中包含标签,则病原体通过调用生成它们pathogen#helptags().标签生成到doc插件的文件夹中.然后这些文件在git存储库中显示为未跟踪.
你知道如何在不同的位置生成标签吗?所有标签都可以在同一个地方,目标不是将它们生成到插件所在的目录.病原体可以说服吗?
我们一直在研究git子模块,我们想知道使用子模块的存储库有什么优势(如果有的话),在另一个存储库中有一个带有.gitignore文件的存储库.
没有子模块的示例:
mkdir a
cd a
git init
touch test1.txt
echo "b" > .gitignore
git add .
git commit -m "Adding test1.txt and gitignore"
mkdir b
cd b
git init
touch test2.txt
git add .
git commit -m "Adding test2.txt"
git log
cd ..
git log
Run Code Online (Sandbox Code Playgroud) 我希望我的.gitignore忽略某些文件夹和文件,所以我想出了以下内容:
*.class
# usual java ignores
bin/
.metadata
# Maven
*/target/*
target/*
/target/
*/deploy/*
deploy/*
# src-gen folder is populated by the command of protobuf, these files should not be pushed
src-gen/*
# eclipse generated stuff
dependency-reduced-pom.xml
# we shouldn't have .jar files in our repository,
# apart from these 5 jars which are vital for our build process
*.jar
!/projectName/bundle/**/*.jar
# For Unix editors
# sometimes make file copies ending
# with ~
# To ignore them use:
*~ …Run Code Online (Sandbox Code Playgroud)