GitHub Workflow

Fork 一个代码库到自己的 GitHub 账号,原库称为 upstream,自己的库称为 origin. (需要正确配置remote

git remote -v
origin    [email protected]:li2/xxx-Android.git (fetch)
origin    [email protected]:li2/xxx-Android.git (push)
upstream    [email protected]:google/xxx-Android.git (fetch)
upstream    [email protected]:google/xxx-Android.git (push)
  • Git Tag 用来标记 release 版本,which is branch from master branch.
  • Master branch 可以看做是 production.
  • Develop branch 是持续开发的分支。

比如需要修复一个 production bug,流程:

  1. 先 checkout 到 release tag,然后这里建立自己的分支:

     git fetch upstream --tags
     git checkout v1.4.0_b35_2108201
     git checkout -b bugfix-1479/login-error
    
  2. 修改代码后 commit;

  3. rebase 并提交

    1. checkout develop 分支并 pull 到最新;
    2. 切回到自己的分支执行 git rebase;
    3. 没有conflict则直接push;有则解决conflict后, git rebase --continue 直到没有conflict 然后push。
  4. 然后就可以在自己的 GitHub repository 看到这个 branch,这时候就可以 open a pull request.


See:

About GitHub Releases & Tags

Releases are GitHub's way of packaging and providing software to your users. You can think of it as a replacement to using downloads to provide software. With Releases, you can provide links to binary files, as well as release notes describing your changes. At their core, Releases are based on Git tags. Tags mark a specific point in the history of your project, so they're a great way to indicate a Release. Releases are ordered by the date they are created on GitHub.

Understanding the GitHub flow

https://guides.github.com/introduction/flow/

Configuring a remote for a fork

https://help.github.com/articles/configuring-a-remote-for-a-fork/

使用 git rebase 提高 PR 质量

https://juejin.im/post/59c7b00df265da065e323acf https://www.jianshu.com/p/4c30eb30323a