Git 技巧合集
2019-11-08 本文已影响0人
_TheSpecialOne
checkout 远程分支
$ git checkout --track origin/newsletter
Branch newsletter set up to track remote branch newsletter from origin.
Switched to a new branch 'newsletter'
删除本地分支
$ git branch -d feature/login
批量删除本地分支
git branch | grep "<pattern>" # 先找到你需要删除的分支
git branch | grep "<pattern>" | xargs git branch -D # 一键删除
删除远程分支
$ git push origin --delete feature/login
删除local stash
- 最简单粗暴的删除全部
git stash clear
- 删除特定stash
git stash list # 查询stash先
git stash drop <stash_id> #按id删除
空提交
- 有时我们仅需要触发build,我们可以使用空提交的方式
git commit --allow-empty -m "Trigger build"