+11

GitHub: Open Source Workflow

skrymsli 8 years ago updated by Al 4 years ago 4

With GitHub I usually fork a project so I have the upstream project repository and my own repository. The upstream repository is read-only to me. I push to branches on my own repository and then I open a pull request from my repo to the upstream repository. Frequently I want to take the latest changes from the upstream repository and merge them into my current branch (or rebase). Currently I do all the fetching/merging/rebasing from the git command line because I don't know how to do it easily from SmartGit. I use SmartGit mainly for reviewing changes, handling conflicts and commits. If this workflow were easier in SmartGit I would not have to use any other tools. If there's an easy way to do this already, point me to the docs!

Under review

Can you please give command line example commands for one complete "cycle"?

Assuming two remotes:

1) origin (your clone)

2) upstream (official repo)


I use 2 options:

1) For small quick work fetch upstream to local branch and work there, then right-click local branch and "push to" origin instead of upstream. Then proceed to pull-request.

2) For larger multi-people work, use origin so you can use gitflow etc. When upstream gets updated, right-click the upstream branch and merge/rebase to you origin branch to update it (just like pulling in single-origin scenario)




To iterate on this, I believe the actual workflow to be more like this:
1) cloning of the offcial repo.
2) create new feature branch.

3) create a Fork on github to store your changes (for either backup or working from different machines).

4) Sync both local and fork with the new official repo changes.

5) Complete feature and push to Fork.

6) Create Pull Request from Fork to official repo.

7) Delete local feature branch, optionally, Fork feature branch, optionally delete entire Fork repo.

Simplified version 
1a) Clone official

2a) create feature branch

3a) complete feature.

4a) Create Pull Request for that feature (meaning automatically create a Fork, push to it, and create a PR). 
5a) Delete Fork once PR is merged.

Step 3 is not currently supported from within Smartgit, but it should be possible to do using the GitHub API. Allowing creation of forks (which would be automatically added as remotes) would greatly enhance the workflow.

Step 6 and 7 are also eh at this moment.

Step 4a would be incredible to have. 

I work on multiple open source projects, some of them have 40+ repos each. I don't want to have and maintain 40 forks, it would be easier to directly work with the official and only create a fork if you need to store personal changes or create a PR.