markdown Git别名

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了markdown Git别名相关的知识,希望对你有一定的参考价值。

# Git aliases
Add these under the `[alias]` tag in your .gitconfig file.

Shortcut for resetting
```
undo = reset --hard 
```

A nice way to see the log
```
pl = log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit
```

See what commits you made yesterday
```
standup = log --all --author='Your git name' --since='yesterday' --format=%s
```

Git flow aliases, creates and pushes branches for you. The branches are named as `variant/your-name`.

Example: `git flow-feature my-feature` would become `feature/my-feature`.
Note that the `flow-do-release` won't work if the master and/or develop branch is locked. 
```
# Custom Flow aliases
flow-init = !sh -c 'git checkout -b develop && git push -u origin develop' -
flow-bug = !sh -c 'git checkout -b bug/$1 && git push -u origin bug/$1' -
flow-feature = !sh -c 'git checkout -b feature/$1 && git push -u origin feature/$1' -
flow-release = !sh -c 'git checkout -b release/$1 && git push -u origin release/$1' -
flow-do-release = !sh -c 'CURRENT=$(git rev-parse --abbrev-ref HEAD) && \
			git checkout master && \
			git pull && \
			git merge $CURRENT && \
			TAG=$(echo $CURRENT| cut -d'/' -f 2) && \
			echo "Tagging version: ${TAG}"  && \
			git tag -a $TAG -m "$(echo "Release:"$TAG)" $(git rev-parse HEAD) && \
			git push --follow-tags && \
			git checkout develop && \
			git pull && \
			git merge $CURRENT && \
			git push' -
flow-clean = !sh -c 'git branch | grep "feature/" | xargs git branch -D && \
      git branch | grep "bug/" | xargs git branch -D && \
 			git branch | grep "release/" | xargs git branch -D' -
```

以上是关于markdown Git别名的主要内容,如果未能解决你的问题,请参考以下文章

markdown 我的Git别名

markdown git的常用别名

markdown 命令行别名

markdown Bash / zsh中的别名

markdown 有用的别名

markdown 显示/隐藏隐藏文件终端别名