is there a way to make an alias for creating, a new branch? For example, I want to type "feat" and get something like "feature/blabla-" so I will need to add just a number.

i want to type git checkout 'feat' press tab for example and get 'git checkout feature/blabla'

  • 2
    where you type feat? after git ... or as its own command? and could you spell out what you want the new command to look like? – Jeff Schaller Feb 10 '19 at 14:09
  • You're most likely going to want a function – jesse_b Feb 10 '19 at 14:14
  • i want to type git checkout feat press tab for example and get git checkout feature/blabla- – 4knort Feb 10 '19 at 14:46
  • @4knort Welcome to the site. If you want an answer then I recommend that you say that in your question? (you can edit your own question). – ctrl-alt-delor Feb 10 '19 at 14:50

If I understood your question well, what you can do is tinker with your .gitconfig (probably on your home) like this (if you have git configured):

  feat = checkout

and you will can do this: git feat.

Other ways to do:

$ git config --global alias.st status

On unix, use single quotes if the alias has a space:

$ git config --global alias.ci 'commit -v'

On windows, use double quotes if the alias has a space or a command line argument:

c:\dev> git config --global alias.ci "commit -v"


In case your doubt is not this, I'm sorry.

  • i want to type "git checkout feat" and get "git checkout feature/blabla-" I want to create a branch faster – 4knort Feb 10 '19 at 17:42
  • Using this alias you can type: git feat name_of_branch – GiovanniSM20 Feb 11 '19 at 21:08

It is possible with bash-completion for git. Asciinema recording below.

Installation or configuration depends on your OS.



You could define a shell variable feat=feature/blabla, and then use git checkout $feat-7. In some shells (zsh for example, but not in bash), you can then press tab after $feat to expand it directly to feature/blabla.


The downside is the added dollar sign, but the upside is that it works in pretty much every shell by simply adding that variable definition.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.