xargs (or something else) without space before parameter

I would like to execute something like this (git squash):

git rebase -i HEAD~3

extracting the 3 from git log:

  • Git: How to ensure new branch is based on upstream master
  • What does the word TREESAME mean in the context of git?
  • How can I integrate git and svn for TeamCity?
  • Creating a git repository from a production folder
  • Versioning on development and release branches (git-flow)
  • Git and file renaming and replacing
  • git log | blabla | xargs git rebase -i HEAD~
    

    This does not work because xargs inserts a space after HEAD~.

    The problem is that I want to alias this command, so I cannot just use

    git rebase -i HEAD~`git log | blabla`
    

    because the number would be evaluated just when I define the alias.

    I don’t have to use xargs, I just need an alias (preferably not a function).

  • xslt cloning with partial data
  • Git pushd & popd? I.e., checkout last state
  • Unable to see the newly created branch after cloning my own git repository on my laptop
  • Remove sensitive files and their commits from Git history
  • Automatic updating build number before commit to git
  • Should I git ignore xcodeproject/project.pbxproj file?
  • 2 Solutions collect form web for “xargs (or something else) without space before parameter”

    You can use the -I option of xargs:

    git log | blabla | xargs -I% git rebase -i HEAD~%
    

    Try this:

    git log | blabla | xargs -i bash -c 'git rebase -i HEAD~{}'
    
    Git Baby is a git and github fan, let's start git clone.