www.liaoxuefeng.com/wiki/896043… Just read Miss Liao Xuefeng’s.

Git team development process

Step 1 Establish a connection locally to Github or Gitee

You can download Git locally and then connect your local git to the code cloud or Github (so that you don’t need to input your username and password every time you commit).

The second step is to build a warehouse

Next, take the code cloud as an example. Create a new one in the code cloudgit-demoWarehouse, which can be selected when creating a warehouse.gitgnoreThe environment forNodeThis way, the code will not be committed when it is committednode_moduleFile in.

Step 3 Create a branch

First create a few branches on the code cloud, the case creates’zechun‘, ‘zhouyu‘, ‘zhangxu‘These three new branches.In the future, our code will be uniformly submitted to the corresponding branch, and finally submitted to the master branch by merging the merge (remember to pull others’ code before submitting to the Master branch when submitting code for multi-player development). Also invite team members into the warehouse management

Step 4 Pull the remote branch to the local branch

Open the editor locally and pull the remote branch to the local.

Start by initializing the Git repository

git init
Copy the code

If there is no local code, pull the remote branch directly

Git clone -b remote branch name repository address git clone -b remote branch name repository address  git clone -b zechun [email protected]:zzccty/git-demo.gitCopy the code

If the repository code already exists locally, simply execute the following command

Git branch -r git remote update origin --prune Git checkout -b zechun origin/zechun // Git branch -- set-upupstream to origin/zechun zechun // pullCopy the code

Step 5 Submit the code

You modify the code in your local repository and submit it to your remote branch

Git add. Git commit -m 'git push originCopy the code

Step 6 Merge

Merge the modified branch into the master branch.

Suppose we are now on the Zechun branch, just finished developing the project, and execute the following command:

Git add. Git commit -m 'git push origin zechunCopy the code

Want to merge zechun branch into Master branch

  • First switch above the master branch
Git checkout -b master origin/master // 2 Git checkout master Git pull Origin Master git pull origin masterCopy the code
  • Then we merge the zechun branch code into the master
Git remote update origin --prune git branch -rCopy the code

Some common mistakes

  • fatal: refusing to merge unrelated histories

Blog.csdn.net/qq_39400546…

A link to the

Blog.csdn.net/qq_14813265… www.jianshu.com/p/26d050497… Blog.csdn.net/hua_ban_yu/… www.cnblogs.com/runnerjack/… Blog.csdn.net/ying422/art… Blog.csdn.net/zmemorys/ar… Blog.csdn.net/qq_39400546…