git 零散笔记

git log 输出作者 提交日期

git log --oneline   一行显示log内容

git log --pretty=format:"%cn committed %h on %cd" 以一种指定的格式显示Log内容。%cn表示commit-name,%h表示commit-hash,%cn表示commit-date

git log -3 只显示最近三次更新

git log --after="2014-7-1" 显示日期2014.7.1之后的commit

git log --after="2014-7-1" --before="2014-7-4" 显示时间段内的commit

git log --author="John" 只显示作者John的commit

git log -- foo.py bar.py  显示文件foo.py和bar.py的commit,--表示后面的是文件名而不是分支名,如果分支名和文件名相同,--可以省略

git log <since>..<until> 显示两次commit之间的commit历史

git log --graph --pretty=format:'%Cred%h%Creset -%an : %C(yellow)%d%Creset %s %Cgreen(%cr)%Creset' --abbrev-commit --date=relative
 
git reflog:可以看到用户在这个分支上的所有操作,不小心git commit --amend之后的修改都可以通过reflog来找到。
https://stackoverflow.com/questions/38001038/how-to-undo-a-git-commit-amend/38002218?utm_medium=organic&utm_source=google_rich_qa&utm_campaign=google_rich_qa
 
git branch -vv 可以看到本地branch关联的远程branch是哪个
 

Git patch

1, git diff > my.patch

2, git apply --check my.patch检查该patch能否应用到当前代码中

3git apply my.patch

 
git squash 合并多个commit
posted @ 2019-07-16 22:30  CobbLiu  阅读(75)  评论(0编辑  收藏  举报