Xargs (or whatever) no space in front of the parameter
I would like to execute something like this (git squash):
git rebase -i HEAD~3
extract 3 from git log
:
git log | blabla | xargs git rebase -i HEAD~
It doesn't work because xargs inserts a space after HEAD~
.
The problem is that I want the alias for this command, so I can't just use
git rebase -i HEAD~`git log | blabla`
because the number will only be evaluated when defining the alias.
I don't need to use xargs
, I just need an alias (preferably not a function).
+3
Gismo ranas
source
to share
2 answers
You can use the option -I
for xargs
:
git log | blabla | xargs -I% git rebase -i HEAD~%
+7
choroba
source
to share
Try the following:
git log | blabla | xargs -i bash -c 'git rebase -i HEAD~{}'
+1
klashxx
source
to share