git alias
Git alias (Git别名)
Description
Description
A git alias, also known as a shortcut, creates short commands mapping the longer ones. It demands fewer keystrokes to run a command, which simplifies the developers’ work. Direct git alias command doesn’t exist. This type of command is created through the git config command and the git configuration files. Aliases can be generated in a local or a global scope with other configuration values.
Creating Aliases with Git
Creating Aliases with Git (使用Git创建别名)
There are two ways of creating Git aliases: using the git config and directly editing the .gitconfig file.
git config --global alias.c commit
Aliases for Git Commands
Aliases for Git Commands (Git命令的别名)
Here are some useful git aliases that just replace the original git command and are designed to make you type less:
Aliases | Description |
---|---|
cob = checkout -b | Checkouts a new not yet existing branch. |
f = fetch -p | Fetches from a repository and prune any remote-tracking no longer existed references on the remote. |
p = push | Push the changes to a remote. |
bd = branch -d | Deletes a branch only if it has been merged. |
ba = branch -a | Lists both remote-tracking and local branches. |
bD = branch -D | Force to delete a branch. |
dc = diff –cached | Displays the staged changes. |