Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I rename a custom Git alias?

Tags:

git

alias

rename

I created a bunch of alias shortcuts. I want to rename one of them. For example, let's create alias al which will display all the aliases that are already defined in my configuration file:

git config --global alias.al '!git config --list | grep ^alias\.'

My alias is now saved in the configuration and it looks like this:

alias.al=!git config --list | grep ^alias\.

I can call it by simply typing in git al.

How do I rename this alias? For example, from 'al' to only 'l'? I could of course use:

git config --global --unset alias.al

And then type:

git config --global alias.l '!git config --list | grep ^alias\.'

But is there a way to do it in one simple command instead, without using --unset?

like image 592
DevWL Avatar asked Sep 16 '25 07:09

DevWL


1 Answers

To directly answer your question, I doubt this can be done in one command.

I'd recommend using your favorite editor and editing the .gitconfig file. Since this is a global alias, it would be in your home directory:

vim ~/.gitconfig

You can easily change the aliases in there.

like image 153
CDub Avatar answered Sep 17 '25 23:09

CDub