Pass an argument to a Git alias command

前端 未结 4 1311
醉话见心
醉话见心 2020-11-27 16:01

Can I pass arguments to the alias of a Git command?

I have some alias in Git config, like so:

rb1 = rebase -i HEAD~1
rb2 = rebase -i HEAD~2
rb3 = reb         


        
4条回答
  •  执笔经年
    2020-11-27 16:37

    I wrote this function "grb" to do Git interactive rebase on a Mac, so I can say grb 5 to show my last 5 commits:

    function grb {
      git rebase -i HEAD~$1
    }
    

    The top answer on this page does not work for me. To see my .bash_profile and all other Git aliases I use on my Mac:

    https://github.com/rayning0/bash_profile/blob/master/.bash_profile#L146

提交回复
热议问题