常用 Git 命令
Branch
# 列出远程分支 git branch -r # 删除远程分支 git push -d origin {branch_name} git push origin :{branch_name} # 删除本地分支 git branch -D {branch_name} # 推送到指定的上游 git push -u origin --all
Commit
# 撤销本地最后一次 commit git reset --soft HEAD~1 # 查找包含某个 commit 的分支 git branch --contains {commitid} # 拷贝一个 commit 到当前分支 git cherry-pick {commit_id} # 放弃本地版本,以远程版本为准 git fetch origin git reset --hard origin/{branch_name} git pull # 回滚提交 git revert {commit_id}
Stash
# 暂存 git stash save "message ..." # 暂存未跟踪文件 git stash --include-untracked
其他
# 清理目录 git clean -fxd -q
相关推荐
LynnOhYeah 2020-07-18
lljhi0 2020-07-21
huangchunxia 2020-07-08
nebulali 2020-07-05
formula 2020-11-12
huhongfei 2020-11-05
乾坤一碼農 2020-10-27
liumengyanysu 2020-10-22
E哥的aws认证攻略 2020-10-15
tianyafengxin 2020-10-08
guying 2020-10-05
好脑筋不如烂笔头 2020-09-17
nebulali 2020-09-11
佛系程序员J 2020-09-15
fenggit 2020-09-15
JustHaveTry 2020-09-11
兄dei努力赚钱吧 2020-09-06