I have very在项目中嵌套目录,我是一个懒惰的程序员。
假设我有一个文件名EventEditor.foo
我想暂存我的文件,无论它是在根目录还是在./src/holy/sweet/mother/of/baby/raptor/jesus/this/is/a/long/hiearchy/EventEditor.foo
我的目标是,“Yo Git,添加 EventEditor”然后砰的一声。它让我只需输入类似的内容即可上演git add *EventEdi*
。这可能吗?还是我在做白日梦?
如果您想在使用时递归地匹配 globgit add http://www.kernel.org/pub/software/scm/git/docs/git-add.html,启动您传入的 globgit add
带有目录名称(例如.
对于当前目录),并确保 glob 包含在引号中,以便 Git 可以解释它而不是 shell:
git add "./*EventEdi*"
一个完整的例子:
$ git init git-add
Initialized empty Git repository in /Users/lambda/tmp/stackoverflow/git-add/.git/
$ cd git-add/
$ mkdir -p foo/bar/baz
$ touch foo/bar/baz/some-long-filename.txt
$ git add "./*long-filename*"
$ git status
# On branch master
#
# Initial commit
#
# Changes to be committed:
# (use "git rm --cached ..." to unstage)
#
# new file: foo/bar/baz/some-long-filename.txt
#
来自manual http://www.kernel.org/pub/software/scm/git/docs/git-add.html:
文件团(例如*.c
) 可以添加所有匹配的文件。也是一个主目录名称(例如dir
to add dir/file1
and dir/file2
) 可以递归地添加目录中的所有文件。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)