Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

如何学习开源项目甚至发起 PR ? #109

Open
yanyue404 opened this issue Nov 28, 2019 · 0 comments
Open

如何学习开源项目甚至发起 PR ? #109

yanyue404 opened this issue Nov 28, 2019 · 0 comments

Comments

@yanyue404
Copy link
Owner

yanyue404 commented Nov 28, 2019

源码学习

1. 对项目足够了解

2. 查看项目早期代码

早期提交日志

参数说明:

  • --pretty=format 控制显示的记录格式
  • --reverse 倒序排列
  • -n 查看前 n条纪录
$ git log --pretty=format:"%h [%an - %ar] : %s" --reverse

# Vue
5f19affa [Evan You - 5 years ago] : init
706c67d1 [Evan You - 5 years ago] : restructure

# checkout 到 commmit id
$ git  checkout 706c67d1
# 再回来
$ git checkout master

# --pretty=format 显示控制参数
选项	 说明
%H	提交对象(commit)的完整哈希字串
%h	提交对象的简短哈希字串
%T	树对象(tree)的完整哈希字串
%t	树对象的简短哈希字串
%P	父对象(parent)的完整哈希字串
%p	父对象的简短哈希字串
%an	作者(author)的名字
%ae	作者的电子邮件地址
%ad	作者修订日期(可以用 -date= 选项定制格式)
%ar	作者修订日期,按多久以前的方式显示
%cn	提交者(committer)的名字
%ce	提交者的电子邮件地址
%cd	提交日期
%cr	提交日期,按多久以前的方式显示

制作常用命令别名

$ git config --global alias.logs "log --pretty=format:'%h [%an - %ar] : %s'"

# 使用
$ git logs --reverse

参考资料

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant