1.列出打tag的日期和tags
gitfor-each-ref --sort=taggerdate --format'%(refname) %(taggerdate)'refs/tags
2.获取本次提交改了哪些东西
git show 891fbfd8fcff0961f16f7ab44c5198fda58ac27b(commit id):显示本次提交的所有信息
git show c4b694d0a4072dcfc59dd14f72f94edfa0b4b2dd -- gringotts/gringotts/classes/UI/Home/ViewController/WDSDHomeViewController.m b/gringotts/gringotts/classes/UI/Home/ViewController/WDSDHomeViewController.m(文件路径):查询指定文件有哪些修改
3.比较两次提交差异
查询两次提交有哪些文件改动
git diff 891fbfd8fcff0961f16f7ab44c5198fda58ac27b 6a8f335a5356c3a39bfe313c4d317bdd3f70a1fb --stat
查询两次提交单个文件修改了哪些地方
git diff 891fbfd8fcff0961f16f7ab44c5198fda58ac27b 6a8f335a5356c3a39bfe313c4d317bdd3f70a1fb -- gringotts/gringotts/classes/UI/Home/View/KYHHomeOpenProtocolView.m
4.git远程删除分支后,本地git branch -a 依然能看到的解决办法
git remote show origin //可以看到删除分支情况
git remote prune origin //删除不存在的分支
再执行
git branch -a
5.git获取本地分支检出时间,并且按时间先后排序
a.打开终端执行vi ~/.gitconfig
b.把下面git alias加到你的~/.gitconfig
[alias]
lb = !"for k in `git branch|perl -pe s/^..//`;do echo `git show --pretty=format:\"%Cgreen%ci %Cblue%cr%Creset\" $k|head -n 1`\\\t$k;done|sort”
网友评论