I have a large code repo I work with that, once compiled, litters the git source tree with about 3000 extra files (.o
s, .so
s, etc), as well as a few hundred other file changes (autogenerated files, permissions, etc). So I've gotten used to doing a git clean -f
and git reset --hard HEAD
before every pull
, to avoid the mountains of conflicts I would get.
I'm trying to automate this into a pretty little script, but I can't find any way to redirect the output of git clean
. Specifically, I'm doing something like this:
(in fish-shell)
set -l linecount ( git clean -n | wc -l )
git clean -f | pv -l -s $linecount
I've tried setting pv
to be the $PAGER
and enabling --paginate
, no luck. I've tried various combinations of the pipe like 2>&1 |
to no avail.
Anyone know how to make this work?
Doh.. Seems this was user error...
pv
echoes input to output. Duh.. Correct syntax should have been:
git clean -f | pv -l -s $linecount > /dev/null
And now it works!