zero-step
set teammate can just read
firts-step
create dev branch
second-step
fork team project to your own repository
third-step
clone project to local
git clone git@github.com:itLeeyw/Renaissance.git
git branch # view branches
git branch -a # view all local and remote branches
git checkout -b dev origin/dev # create a dev branch , clone remote dev to local, switch to local dev branch
ls / dir # view dev branch detail
fourth-step (Stay abreast of team projects)
git remote -v # 查看是否设置upstream
# origin git@github.com:SethLee23/git-flow-1.git (fetch)
# origin git@github.com:SethLee23/git-flow-1.git (push)
# git remote add upstream 团队项目地址
git remote add upstream git@github.com:SethTeam/git-flow.git
git remote -v
# origin git@github.com:SethLee23/git-flow-1.git (fetch)
# origin git@github.com:SethLee23/git-flow-1.git (push)
# upstream git@github.com:SethTeam/git-flow.git (fetch)
# upstream git@github.com:SethTeam/git-flow.git (push)
git fetch upstream # 获取团队项目最新版本
git merge upstream/dev # 将源分支(upstream/dev)合并到当前分支(dev)。
fifth-step (push change to your own project)
git push
sixth-step (pull request to your team project)
- click 'Pull request' link
- select base fork branch and head fork barnch, add some comment, review what you changed and then Create pull request
seventh-step
- as a team leader, enter the team repo, view how many 'pull request'
- select one of 'Pull requests'
- pay attention to next two tips:
- the source branch and the target branch
- click the 'pull request' link, view what changed
- if ok, click 'Merge pull request'
decrease [.git] dir size and numbers
git gc
- merge local branch
# 1. set branch in local
git checkout -b lsq
# 2. save local branch and push to remote
git add .
git commit -m'RF#save local branch and push to remote'
git push origin lsq:lsq-remote
# 3. make pull-request on github or merge branch local (git push -u lsq:main)
# before merge local branch to remote,you should save it
git checkout main
git merge lsq
git status
git push origin main