0

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 at 14:09
  • You're most likely going to want a function – Jesse_b Feb 10 at 14:14
  • i want to type git checkout feat press tab for example and get git checkout feature/blabla- – 4knort Feb 10 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 at 14:50
1

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):

[alias]
  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"

Credits

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 at 17:42
  • Using this alias you can type: git feat name_of_branch – GiovanniSM20 Feb 11 at 21:08
0

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

Installation or configuration depends on your OS.

asciicast

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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