E
E
Evgenij_nechujveter2021-07-24 07:27:29
git
Evgenij_nechujveter, 2021-07-24 07:27:29

How to set alias for git globally?

How to set alias for git globally?
I know that you need to write your aliases in the .gitconfig file.
Now I have this:

[alias]
  co = checkout
  ci = commit
  st = status
  gs = git status
  br = branch
  hist = log --pretty=format:\"%h %ad | %s%d [%an]\" --graph --date=short
  type = cat-file -t
  dump = cat-file -p


And now the command in the terminal looks, for example, for the status like this "git st"
But how to shorten it even more so that you do not have to write the git keyword before the command every time?
To show the status after typing "st" instead of git st?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
B
BorLaze, 2021-07-24
@Evgenij_nechujveter

This is already a system alias, not a git.
For bashin the file ~/.bash_aliasesand write: Then re-read the file:
alias st='git status'
. ~/.bash_aliases

A
Alexey Ukolov, 2021-07-24
@alexey-m-ukolov

Create a system alias. How to do this (and whether it is possible at all) depends on the OS.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question