如何在OCA上贡献自己的代码?
-
系统环境:ubuntu 14.04 LTS
1. 在github上注册自己的账号,github注册网址:https://github.com
2. 用git推送自己的代码到OCA上的中国代码库:https://github.com/OCA/l10n-china
2.1 将OCA的l10n-china库fork到自己的github里,创建自己的远端l10n-china代码库
2.2 将自己的远端代码库克隆到本地
方式一:https(提交代码的时候要输入github账号密码) git clone https://github.com/Rona111/l10n-china.git br /> 方式二:ssh(需要添加ssh key,可以直接提交) git clone [email protected]:Rona111/l10n-china.git
2.3 检查本地的remote情况,拉取远端OCA库的链接,以便代码同步(采用ssh方式)
git remote -v (查看已有remote)
git remote add upstream [email protected]:OCA/l10n-china.git
git remote -v (重新查看,确认已增加远端OCA库的链接)
2.4 在本地的git上创建自己的分支,并在自己的分支下工作
git checkout -b add_module_hr_to_oca
2.5 提交自己的工作内容
git commit 输入主题或关键字
ctrl+X && Y 退出并保存
2.6 推送本地的分支到自己远端的代码库
git push --set-upstream origin add_module_hr_to_oca(首次提交,后续只要键入git push)
2.7 到github上根据自己提交的内容提示,提交一个pr(Pull Request)
3. 修复改进自己的代码
当你提交你的代码后,如果有人对你的成果提出建议或意见,我们可以在本地修改自己的代码,重复2.5和2.6操作。
进阶git技巧:
1. 将远端未被合并的的pull request拉到本地
git fetch upstream pull/9/head:new_local_branch_name_pr_9
2. 同步远端的代码库到本地
方式一: git pull
方式二:(建议使用) git fetch --all && git merge 9.0 upstream/9.0 -
赞!
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login