Created
August 13, 2024 13:30
-
-
Save chongiscool/caed4db3a1a157fc61c4169ecea8a798 to your computer and use it in GitHub Desktop.
.gitconfig for alias
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[alias] | |
co = checkout | |
co-b = checkout -b | |
br = branch | |
br-r = branch -r | |
br-a = branch -a | |
br-m = branch -m | |
br-d = branch -d | |
br-force-d = branch -D | |
ci-reset-author = commit --amend --reset-author | |
st = status | |
# similar 'git st', but less message | |
st-s = status -s | |
ci = commit | |
ci-m = commit -m | |
ci-amend = commit --amend | |
add-a = add -A | |
remote-v = remote -v | |
push-u-origin = push -u origin | |
# 注释掉这个unstage操作,用法有点过时了 | |
# unstage = reset HEAD -- | |
# 最新的unstage操作方式 | |
unstage = restore --staged | |
# 注释掉这个unchange操作,用法有点过时了 | |
# unchange = checkout -- | |
# 最新的unchange操作方式,如:git unchange foo.txt; git unchange . | |
unchange = restore | |
# Latest Alias | |
git-c = git clone | |
# log | |
last = log -1 HEAD | |
log-pretty = log --pretty=oneline | |
log-all-branch = log --pretty=format:"%ad:%an:%d:%B" --date=short --reverse --branches | |
log-graph = log --graph --decorate --oneline --all | |
# stash | |
# 'git stash push' equals to 'git stash save' | |
stash-push = stash push | |
# outdated but still can use it | |
# stash-save = stash save | |
# 这个命令会stash staged文件,但不会管untrack文件(没有add的文件) | |
# 于是会让staged文件和untrack文件保留在索引中(即,git st之后还能看到有东西) | |
# 一般坚决,慎用它 | |
stash-save-keep-index = stash push --keep-index | |
# '-u' equals '--include-untracked' | |
# 会保留所有的状态(修改状态,staged状态,新增文件仍然处于untrack状态) | |
# 常用它,stash(贮存)modified,staged,untrack file的状态 | |
stash-save-include-untracked = stash push -u | |
stash-drop = stash drop | |
stash-pop = stash pop | |
stash-list = stash list | |
# 恢复stash时,将staged的文件,给unstaged了 | |
stash-apply = stash apply | |
# 恢复stash时,会保留staged,untracked file 的状态 | |
# 常用它 | |
stash-apply-index = stash apply --index | |
# user | |
# set user info in local repo | |
cun = config user.name | |
cue = config user.email | |
# set user info globally | |
cgun = config --global user.name | |
cgue = config --global user.email | |
remote-add-origin = remote add origin | |
remote-set-url-origin = remote set-url origin |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment