1

For instance, we want to add the contents of all Media directories that Git has been told to ignore. The directories are scattered throughout our project. Running git add -A -f isn't a solution, because it adds everything. An alternative is to add each individually, though that would take some time like this:

git add /Path/To/Media/*
git add /Other/Path/To/Media/*
Shaun Luttin
  • 133,272
  • 81
  • 405
  • 467

1 Answers1

1

This is what worked for us in PowerShell.

git add **/Media/* -f

hvd points out that this only works on my environment (though I haven't confirmed this myself,) which is PowerShell on Windows 8.1.

Shaun Luttin
  • 133,272
  • 81
  • 405
  • 467
  • 1
    This is not part of git. It is something some shells offer, but not all. In the shell I'm using, for instance, `**` simply means the same thing as `*`, so searches for all directories `Media` that are exactly one level deep. –  May 24 '15 at 20:51
  • @hvd From the release notes here https://github.com/git/git/blob/master/Documentation/RelNotes/1.8.2.txt it looks like `**` has some special meaning in .gitignore and pathname-like things. – Shaun Luttin May 25 '15 at 16:36
  • 1
    Yes, it does, but not (to Git) in the context you're using it. Git won't even see it, because the shell expands it before it gets to Git, and you can confirm this by using software to monitor precisely how Git is invoked. For instance, on Linux, try `strace -e execve $SHELL -c 'exec git add **/Media/* -f'`. You'll find that the actual `execve` to `git` won't contain any `*` in the command-line arguments. Other platforms may have similar tools. –  May 25 '15 at 21:12