git工作流

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 [email protected]: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  [email protected]:SethLee23/git-flow-1.git (fetch)
# origin  [email protected]:SethLee23/git-flow-1.git (push)

# git remote add upstream 团队项目地址
git remote add upstream [email protected]:SethTeam/git-flow.git

git remote -v
# origin  [email protected]:SethLee23/git-flow-1.git (fetch)
# origin  [email protected]:SethLee23/git-flow-1.git (push)
# upstream        [email protected]:SethTeam/git-flow.git (fetch)
# upstream        [email protected]: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:
  1. the source branch and the target branch
  2. click the 'pull request' link, view what changed
  3. if ok, click 'Merge pull request'

关于 git 的一些操作

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

github 团队管理合作流程参考

你可能感兴趣的:(git工作流)