Development Workflow with Git
This document shows the workflow of how to develop DevStream with Git.
Step 1 - Fork the repo
- Visit the DevStream repo: https://github.com/devstream-io/devstream;
- Click the
Fork
button to create a fork of the DevStream.
Step 2 - Clone the repo
- Define some basic environment variables
Please set the appropriate values according to your actual environment.
Bash
export WORKING_PATH="~/gocode"
export USER="daniel-hutao"
export PROJECT="devstream"
export ORG="devstream-io"
- Create your clone locally
Bash
mkdir -p ${WORKING_PATH}
cd ${WORKING_PATH}
# You can also use the url: git@github.com:${USER}/${PROJECT}.git
# if your ssh configuration is proper
git clone https://github.com/${USER}/${PROJECT}.git
cd ${PROJECT}
git remote add upstream https://github.com/${ORG}/${PROJECT}.git
# Never push to upstream locally
git remote set-url --push upstream no_push
- Confirm the remotes you’ve set is make sense
Execute git remote -v
and you’ll see output like below:
Bash
origin git@github.com:daniel-hutao/devstream.git (fetch)
origin git@github.com:daniel-hutao/devstream.git (push)
upstream https://github.com/devstream-io/devstream (fetch)
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
git fetch upstream
git checkout main
git rebase upstream/main
Step 4 - Coding
First, you need to pull a new branch, the name is according to your own taste.
Bash
git checkout -b feat-xxx
Then start coding.
Step 5 - Commit & Push
Bash
git add <file>
git commit -s -m "some description here"
git push -f origin feat-xxx
Then you can create a pr
on GitHub.