首页 > 其他 > 详细

Git 实用技巧

时间:2019-11-19 15:40:37      阅读:79      评论:0      收藏:0      [点我收藏+]

Git 实用技巧

git 命令行查看提交记录

git log —graph —all -p —decorate —abbrev-commit
 —graph 以图像显示
 —all 显示所有分支
 —decorate 显示所有分支名和 tag 名
 —abbrev-commit 只显示简短的 hash 值
 -p 显示提交的文件差异

从某一个提交开始重置所有提交

git rebase -i hash

获取所有远程tag

git fetch origin -t

推送所有本地新tag

git push origin --tags                                                                       

更新tag命令

(将 orgin tag 更新至 new orign)

git fetch origin --t && git push new-origin --tags && git tag -l | xargs git tag -d && git fetch

删除所有本地tag

git tag -l | xargs git tag -d

删除所有特定tag并推送

git tag | grep ZICE | xargs -n 1 git push --delete origin  

获取所有远程tag

git fetch

Git如何删除版本库中的一个提交

非 master 分支,未 merge 仅取消最后一次提交

1. git reset --hard HEAD~1
2. git push --force

非 master 分支,未 merge 删除过去的某一次提交

git rebase -i 'hash'

Git 如何删除本地所有未提交的更改

git checkout -f &&  git clean -xdf && git pull

Git 实用技巧

原文:https://www.cnblogs.com/herojl/p/11889837.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!