Provides a new git command, git xargs, that runs an arbitrary shell command on
all files under source control. Optionally you can specify a pathspec (such as a
subpath or a glob expression), restricting the operation to a subset of the
repository files.
As git xargs delegates the work to xargs(1), it supports all options provided by the version of xargs installed on your system.
After running
curl -sL https://gist.github.com/jorgsk/23ccc12e783f8624fec0af2d2db19e49/raw/0430391b22558edb08a3af9786ca4f33aca45caf/git-xargs | \
sudo tee /usr/local/bin/git-xargs > /dev/null && \
sudo chmod +x /usr/local/bin/git-xargsin your shell and making sure that /usr/local/bin
is on your PATH, git
will automatically detect git xargs.
git xargs [xargs-options] [<command> <args>]
git xargs [<file>...] -- [xargs-options] [<command> <args>]-
git xargs du -cshows total disk usage of files under source control
-
git xargs -n1 echoequivalent to git ls-files
-
git xargs '*.cpp' '*.c' -- sed -i '' 's/foo/bar/g'replace string foo with string bar in all c and cpp fles under source control
-
git xargs '*.cpp' '*.c' -- rpl foo barsimpler way to do the same. This requires installation of rpl(1).