我希望能够做到以下几点:
$ pwd
/tmp/repo
$ ls -l
/a-dir
/another-dir
.gitignore
a-file
another-file
$ git add -A
<< ONLY .gitignore, a-file and another-file are added >>
我怎样才能做到这一点?
注意:随着时间的推移,可以添加更多文件和目录。应该忽略目录及其所有内容。只应包含位于存储库根目录中的文件。
编辑:我想用 .gitignore 文件来做这个,所以我不必每次都记住运行不同的命令。我只想保持简单git add -A
,并让 .gitignore 处理它。
我在某些时候和你有完全一样的要求,我的.gitignore
样子是这样的:
# Ignore all subdirectories
/*/
# Keep a specific subdirectory
!/foo/
# .gitignore as usual
.vs/
.int/
.out/
*.user
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句