[dev env] Github workflow - e-guy/e-guyNotes GitHub Wiki

Github workflow

(As the project manager)

step 1 - Creat a repository named "proj"

- By default, there is a master branch, we use it as the product release branch.
- We then create a new branch named "dev" and set it as default branch. This new branch is for team development.

(As one developer in the team)

step 2 - clone to local

git clone <repository address>

or, to clone a specific branch

git clone -b <the_specific_branch_name> <respository address> <new_resp_name>

step 3 - I create a new local branch named "bingbing.rao" from local "dev"

git checkout -b bingbing.rao 

(This command will create a new local branch "bingbing.rao" and switch to the new branch.)

step 4 - I create the corresponding remote "bingbing.rao" branch from local "bingbing.rao"

git push origin bingbing.rao 

To see all branch in local and remote:

git branch -all

(Notice: step 1~4 need be performed only at the first setting-up time.)

step 5 - Do some update (add, change, delete) in local "bingbing.rao" branch

step 6 - push to remote bingbing.rao

git add --all
git commit
git push origin bingbing.rao

you can use git status to see status.

step 7 - Do "pull request" from remote "bingbing.rao" to remote "dev", add leave it to the project manager to agree.

step 8 - Then you have two approaches to keep your local "bingbing.rao" branch up-to-date

approach 1:

step 9 - Do "pull request" from remote "dev" to remote "bingbing.rao", agree the request by yourself.

step 10 - pull from remote "bingbing.rao" to local "bingbing.rao"

git pull origin bingbing.rao

Then, your local "bingbing.rao" is up-to-date.

approach 2:

step 9 - switch to local "dev" and update local"dev" from remote "dev"

git checkout dev
git pull origin dev

step 10 - merge local "dev" into local "bingbing.rao"

git checkout bingbing.rao
git merge dev

Then, your local "bingbing.rao" is up-to-data.

ref: git checkout and and git fetch