Stage file by its file name, regardless of directory–Git

If you would like to match a glob recursively when using git add, start the glob you pass in to git add with a directory name (such as . for the current directory), and make sure that the glob is in quotes so that Git can interpret it instead of the shell:

git add "./*EventEdi*"

A full example:

$ 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
#

From the manual:

Fileglobs (e.g. *.c) can be given to add all matching files. Also a leading directory name (e.g. dir to add dir/file1 and dir/file2) can be given to add all files in the directory, recursively.

Leave a Comment

deneme bonusu veren sitelerbahis casinomakrobetceltabetpinbahispolobetpolobet girişpinbahis girişmakrobet girişpulibet girişmobilbahis girişkolaybet giriş