What characters can I use in a Git alias? For example can "my.branch" or "@mine" be aliases?
Is there a way to make the aliases case sensitive? ex: myBranch
The alias documentaion does not list acceptable characters or anything about case sensitivity.
Git aliases are a powerful workflow tool that create shortcuts to frequently used Git commands. Using Git aliases will make you a faster and more efficient developer. Aliases can be used to wrap a sequence of Git commands into new faux Git command.
Alias is a term associated with shortcuts in Git. It compresses the longer sequence of commands to a shorter sequence. It is always better to apply aliases to the frequently used longer commands since it helps in increasing efficiency.
The simplest way to add a git alias is by running a command to add the alias to the git global configuration file. For example, running the command git config --global alias. hist "log --pretty=format:'%h %ad | %s%d [%an]' --graph --date=short" will add the alias git hist .
To create an alias in Git bash, we need to use the “git config” command followed by the “—global” option, an alias to be created, and an original git command in a single instruction.
Your git aliases are often stored per your user's configuration at ~/. gitconfig . You can also manually set aliases using, for example, the command git config alias. s 'status -s' .
man git-config
says:
The variable names are case-insensitive, allow only alphanumeric characters and -, and must start with an alphabetic character.
For those who want to use a dot (.
) as part of the variable name, the same man page also says:
The variables are divided into sections, wherein the fully qualified variable name of the variable itself is the last dot-separated segment and the section name is everything before the last dot.
This should make it clear why those people (including me) are out of hope.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With