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:

AliasesDescription
cob = checkout -bCheckouts a new not yet existing branch.
f = fetch -pFetches from a repository and prune any remote-tracking no longer existed references on the remote.
p = pushPush the changes to a remote.
bd = branch -dDeletes a branch only if it has been merged.
ba = branch -aLists both remote-tracking and local branches.
bD = branch -DForce to delete a branch.
dc = diff –cachedDisplays the staged changes.


请遵守《互联网环境法规》文明发言,欢迎讨论问题
扫码反馈

扫一扫,反馈当前页面

咨询反馈
扫码关注
返回顶部