Make your git work better

1. Shorthand git command

Format: git config –global alias. Shorthand original command

E.g:

//checkout is abbreviated as co

git config --global alias.co checkout

 

//branch is abbreviated as br

git config --global alias.br branch

 

//status is abbreviated as st

git config --global alias.st status

After customization, it can be abbreviated for later use. For example, git st is equivalent to git status. The effect is as follows:

2. Modify the display style of git log results

git log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit

But it is too long, and it is too troublesome to enter so many each time. According to Article 1, we abbreviate the above long series of commands as lg, and the code is as follows:

git config --global alias.lg "log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit"

Use git lg later, the effect is as follows:

Is it very convenient, hurry up and set it up.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326147569&siteId=291194637