第一次开源项目贡献
来源:互联网 发布:大数据产业链包括哪些 编辑:程序博客网 时间:2024/05/17 07:11
简介
第一次写开元项目贡献,并且已经被并入,记录一下过程与总结。写的是GitLab的一个feature, 主要是在现存的repository中上传文件,和替换现存repository中已经存在的文件。原来标题是 ‘add “replace” and “upload” functionality’。
熟悉项目架构
刚开始写的时候首先要熟悉项目的架构, GitLab 是用的 Ruby on Rails, 关于 Ruby on Rails 后期有时间的话会把自己的学习总结一下然后分享出来。这里简要的写两个主要的概念。
MVC 框架
Ruby on Rails 文件目录结构
Gemfile.lockThese files allow you to specify what gem dependencies are needed for your Rails application. These files are used by the Bundler gem. For more information about Bundler, see the Bundler website.lib/Extended modules for your application.log/Application log files.public/The only folder seen by the world as-is. Contains static files and compiled assets.RakefileThis file locates and loads tasks that can be run from the command line. The task definitions are defined throughout the components of Rails. Rather than changing Rakefile, you should add your own tasks by adding files to the lib/tasks directory of your application.README.rdocThis is a brief instruction manual for your application. You should edit this file to tell others what your application does, how to set it up, and so on.test/Unit tests, fixtures, and other test apparatus. These are covered in Testing Rails Applications.tmp/Temporary files (like cache, pid, and session files).vendor/A place for all third-party code. In a typical Rails application this includes vendored gems.
参照 http://guides.rubyonrails.org/getting_started.html
PR 过程以及开发环境
PR 的过程
开发环境
测试
遇到问题
git 使用
在整个过程中对于git的使用感觉自己学习的比较多,有几次甚至可以说起死回生。
怎样把 remote repository 最近的更新并入自己 forked repository
# Add the remote, call it "upstream":git remote add upstream https://github.com/whoever/whatever.git# Fetch all the branches of that remote into remote-tracking branches,# such as upstream/master:git fetch upstream# Make sure that you're on your master branch:git checkout master# Rewrite your master branch so that any commits of yours that# aren't already in upstream/master are replayed on top of that# other branch:git rebase upstream/master# push it to your own forked repositorygit push -f origin master
参照 http://stackoverflow.com/questions/7244321/how-to-update-github-forked-repository
怎样 squash commit
这里有很好的一片文章介绍如何 squash, 我就不在写了。只是写一下上面没有提到的。
squash conflict 处理
squash 过程中可能会有很多的conflict, 这时候你如果使用
git rebase --continue
然后就会提示那些文件有 conflict, 然后你需要一个个的处理这些冲突,直到最后 squash 成功。
squash 提交
squash 之后就是要把它提交到自己的 master repository 中,这个时候一定要强制 push, 要不然的话就会把 squash 的 commit 加在现有 commit 之后。
git push --force origin master
参照 http://stackoverflow.com/questions/5667884/how-to-squash-commits-in-git-after-they-have-been-pushed
http://gitready.com/advanced/2009/02/10/squashing-commits-with-rebase.html
怎样恢复到曾经的commit
自己在 squash commit 的时候不知道要强制 push 到repository, 所以 squashed commit 被加到了原来 repository 中 commit 的最后面,最后想用 hard reset 到最后 commit, 可是最后出了错误。具体的是通过
git reflog
恢复过来的。具体的操作请参照
参照 http://stackoverflow.com/questions/5473/how-can-i-undo-git-reset-hard-head1
源代码
- 第一次开源项目贡献
- 第一次向开源项目贡献代码的历程
- 开源项目贡献
- 在Github上的开源项目:你的第一次贡献(原文:Open Source on Github: Your First Contribution)
- 纪念我第一次为开源社区贡献的代码
- 第一次为开源社区贡献力量,mark下^_^
- 近百android开源项目贡献
- 近百android开源项目贡献
- 近百android开源项目贡献
- 战争结束:微软为 SAMBA 开源项目贡献代码
- 在 GitHub 上贡献开源项目的一般步骤
- [GitHub]第六讲:开源项目贡献流程
- [GitHub]第六讲:开源项目贡献流程
- Git——Day2(开源项目贡献流程)
- Github | 如何贡献Android开源项目和提交补丁
- git 怎么为开源项目做贡献,怎么有效管理贡献者的提交
- Pull Request的正确打开方式(如何在GitHub上贡献开源项目)
- 贡献开源项目没那么简单,你要负责到底
- HDU 5444 Elven Postman
- Java - 异常处理
- MySQL问题,设置为不允许为空的字段却可以为空
- unity的forward rendering 中光源的使用和light的render mode
- jenkins系列教程
- 第一次开源项目贡献
- ul li高度在ie6、ie7、ie8、FF下兼容问题解决
- MySQL学习5_CentOS下Mysql数据库(不使用yum命令)的安装与配置
- TFS erasure code实现方案
- 豆瓣爬虫
- SEAndroid中sepolicy/adbd.te策略文件分析
- linux c 使用正则表达式
- Linux chattr和lsattr
- 硬币 coin题解