Development Workflow with Git

This document shows the workflow of how to develop DevStream with Git.

Step 1 - Fork the repo

  1. Visit the DevStream repo: https://github.com/devstream-io/devstream;
  2. Click the Fork button to create a fork of the DevStream.

Step 2 - Clone the repo

  1. Define some basic environment variables

Please set the appropriate values according to your actual environment.

Bash

  1. export WORKING_PATH="~/gocode"
  2. export USER="daniel-hutao"
  3. export PROJECT="devstream"
  4. export ORG="devstream-io"
  1. Create your clone locally

Bash

  1. mkdir -p ${WORKING_PATH}
  2. cd ${WORKING_PATH}
  3. # You can also use the url: git@github.com:${USER}/${PROJECT}.git
  4. # if your ssh configuration is proper
  5. git clone https://github.com/${USER}/${PROJECT}.git
  6. cd ${PROJECT}
  7. git remote add upstream https://github.com/${ORG}/${PROJECT}.git
  8. # Never push to upstream locally
  9. git remote set-url --push upstream no_push
  1. Confirm the remotes you’ve set is make sense

Execute git remote -v and you’ll see output like below:

Bash

  1. origin git@github.com:daniel-hutao/devstream.git (fetch)
  2. origin git@github.com:daniel-hutao/devstream.git (push)
  3. upstream https://github.com/devstream-io/devstream (fetch)
  4. upstream no_push (push)

Step 3 - Keep your branch in sync

You will often need to update your local code to keep in sync with upstream

Bash

  1. git fetch upstream
  2. git checkout main
  3. git rebase upstream/main

Step 4 - Coding

First, you need to pull a new branch, the name is according to your own taste.

Bash

  1. git checkout -b feat-xxx

Then start coding.

Step 5 - Commit & Push

Bash

  1. git add <file>
  2. git commit -s -m "some description here"
  3. git push -f origin feat-xxx

Then you can create a pr on GitHub.