如何开始为Rust项目贡献源代码

以下操作流程是我(Liigo)过去半年来收集、整理、总结,并经过许多次实践检验的。

如果有朋友希望给Rust项目贡献源代码,却不知道如何入手,可以参考一下本文。


Start contributing to #rustlang 

1. Fork it at https://github.com/rust-lang/rust

2. Git clone your fork: git clone https://github.com/liigo/rust.git

3. Config remote upstream: git remote add upstream git://github.com/rust-lang/rust.git

4. Set global user info:

git config --global user.name "Liigo Zhuang"

git config --global user.email [email protected]

5. Start work

git fetch upstream

git checkout -b workbranch master (the first time)

or git checkout workbranch

(do your work: changes and commits)

make && make check (run test suites)

6. Push to your fork (origin) : git push origin workbranch

7. File pull request on github.com, and wait for be merged

8. Delete branches (optional):

git push origin :workbranch (delete remote branch)

git branch -D workbranch (delete local branch)


Squash many commits to one commit:

git checkout workbranch

git rebase -i upstream/master (non-first 'pick' -> 's')

git push origin workbranch

or git push -f (to force push)


Update pull request:

git checkout workbranch

(commit and rebase)

git push

or git push -f (to force push)


Keep origin/master up to date:

git fetch upstram

git checkout master

git rebase upstream/master

git push origin master


Refs:

[fork] https://help.github.com/articles/fork-a-repo

[PR] https://help.github.com/articles/using-pull-requests

[git] https://github.com/mozilla/rust/wiki/Note-git-workflow

[dev] https://github.com/mozilla/rust/wiki/Note-development-policy

[squash] http://git-scm.com/book/en/Git-Tools-Rewriting-History

[squash] http://gitready.com/advanced/2009/02/10/squashing-commits-with-rebase.html



发布了275 篇原创文章 · 获赞 442 · 访问量 244万+

猜你喜欢

转载自blog.csdn.net/liigo/article/details/39272325