git 删除和复制远程分支 储藏
不常用到命令经常查,特别记录,方便自己开箱即用。
1. 删除本地分支
git branch -D <dev>
2. 删除远程分支
git push origin --delete <branchName>
3. 复制远程分支并进入
3.1 git checkout -b <本地新分支名> origin/<远程分支名>
若报错,先 git fetch
4. 储藏 stashing
适用于在某个分支已经修改,需要到其他分支进行操作,修改部分不想commit,但又想储存变更。
存:git stash
历史: git stash list
取: git stash apply
取更早: 指定名字, e.g git stash apply stash_name
从储藏中创建新但分支:git stash branch branch-name
5. git hook 取消
对于某些大文件或是配置文件,改动较小,不想用hook检查, 可以跳过.
git commit -m "comment" --no-vertify