Skip to content
This repository has been archived by the owner on Jun 24, 2020. It is now read-only.

Latest commit

 

History

History
166 lines (116 loc) · 4.47 KB

github-workflow.md

File metadata and controls

166 lines (116 loc) · 4.47 KB

Workflow

Steps below describe workflow for contributing to this repo:

1 Fork in the cloud

  1. Visit https://github.com/GoogleCloudPlatform/k8s-service-catalog
  2. Click Fork button (top right) to establish a cloud-based fork.

2 Clone fork to local storage

Per Go's [workspace instructions][go-workspace], place Service Catalog installer's code on your GOPATH using the following cloning procedure.

Define a local working directory:

# If your GOPATH has multiple paths, pick
# just one and use it instead of $GOPATH here.
# You must follow exactly this pattern,
# neither `$GOPATH/src/github.com/${your github profile name/`
# nor any other pattern will work.
working_dir=$GOPATH/src/github.com/GoogleCloudPlatform

Set user to match your github profile name:

user={your github profile name}

Both $working_dir and $user are mentioned in the figure above.

Create your clone:

mkdir -p $working_dir
cd $working_dir
git clone https://github.com/$user/k8s-service-catalog.git
# or: git clone [email protected]:$user/k8s-service-catalog.git

cd $working_dir/k8s-service-catalog
git remote add upstream https://github.com/GoogleCloudPlatform/k8s-service-catalog.git
# or: git remote add upstream [email protected]:GoogleCloudPlatform/k8s-service-catalog.git

# Never push to upstream master
git remote set-url --push upstream no_push

# Confirm that your remotes make sense:
git remote -v

3 Branch

Get your local master up to date:

cd $working_dir/k8s-service-catalog
git fetch upstream
git checkout master
git rebase upstream/master

Branch from it:

git checkout -b myfeature

Then edit code on the myfeature branch.

Build

cd $working_dir/k8s-service-catalog
make

Test

TBD

4 Keep your branch in sync

# While on your myfeature branch
git fetch upstream
git rebase upstream/master

Please don't use git pull instead of the above fetch / rebase. git pull does a merge, which leaves merge commits. These make the commit history messy and violate the principle that commits ought to be individually understandable and useful (see below). You can also consider changing your .git/config file via git config branch.autoSetupRebase always to change the behavior of git pull.

5 Commit

Commit your changes.

git commit

Likely you go back and edit/build/test some more then commit --amend in a few cycles.

6 Push

When ready to review (or just to establish an offsite backup or your work), push your branch to your fork on github.com:

git push -f ${your_remote_name} myfeature

7 Create a pull request

  1. Visit your fork at https://github.com/$user/k8s-service-catalog
  2. Click the Compare & Pull Request button next to your myfeature branch.
  3. Check out the pull request process for more details and advice.

If you have upstream write access, please refrain from using the GitHub UI for creating PRs, because GitHub will create the PR branch inside the main repository rather than inside your fork.

Get a code review

Once your pull request has been opened it will be assigned to one or more reviewers. Those reviewers will do a thorough code review, looking for correctness, bugs, opportunities for improvement, documentation and comments, and style.

Commit changes made in response to review comments to the same branch on your fork.

Very small PRs are easy to review. Very large PRs are very difficult to review.

Squash and Merge

Upon merge (by either you or your reviewer), all commits left on the review branch should represent meaningful milestones or units of work. Use commits to add clarity to the development and review process.

Before merging a PR, squash any fix review feedback, typo, merged, and rebased sorts of commits.

It is not imperative that every commit in a PR compile and pass tests independently, but it is worth striving for.

In particular, if you happened to have used git merge and have merge commits, please squash those away: they do not meet the above test.

A nifty way to manage the commits in your PR is to do an interactive rebase, which will let you tell git what to do with every commit:

git fetch upstream
git rebase -i upstream/master

For mass automated fixups (e.g. automated doc formatting), use one or more commits for the changes to tooling and a final commit to apply the fixup en masse. This makes reviews easier.