------ git is not difficult to understand the development process flow

001, to create a warehouse

 

002, New Project

 

 

003, this step does not need to do initialization warehouse

git init: Folders will be more of a hidden file .git

 

004, cloning project

git clone <LOCATION>

 

005, write code and submit it to the top github

复制代码
 
  
 

 


. 1, the Add Git index.html
2, Git the commit -m "main branch Submit"
. 3, Git Push
复制代码

 

 

006, see the changes in the document above github

复制代码
复制代码

 

 

007 multiplayer collaborative development (next with Joe Smith, John Doe, CTO trio to demonstrate the process at work)

复制代码

 


1, Zhang clone file: git clone <address> folder name 2, John Doe clone file: git clone <address> folder name 3, Joe Smith to be solved during development BUG . 4, John Doe in the development process requires develop new features
复制代码

 

 008, Joe Smith and submit the file to resolve BUG

复制代码

 


Best not to do in the actual development process in the main branch of things, do things to create a branch 1, create a sub-branch: git Branch zhangsan 2, switching sub-branch: git Checkout zhangsan 3, submitted to the staging area: git add index. HTML 4, submitted to the repository: git "Joe Smith submitted" the commit -m 5, associated with the remote branch: git push --set-upstream origin zhangsan ( this step only the first time when you can do so a second time modify the file when you can go to step 6) 6, submission of documents: git push
复制代码

 

 

009, CTO merge files

复制代码
1、更新本地的分支:git fetch --all

2、切换子分支:git checkout zhangsan

3、切换主分支:git checkout master

4、合并文件:git merge zhangsan   (:wq 按下回车)

5、提交到远端:git push

6、删除子分支:git checkout -d zhangsan  (不需要操作 )
复制代码

 

 

010、李四开发新的功能,但是李四的文件还是以前有bug的文件,因此我们需要最新的代码

复制代码
1、创建并切换子分支:git checkout -b lisi

2、将开发好的新功能提交到版本库:git add index.html    git commit -m "李四提交"

3、切换主分支:git checkout master

4、将远端最新的代码拉取下来:git pull

5、切换子分支:git checkout lisi

6、合并主分支文件:git merge master

7、退出文件:esc 输入wq

8、提交到远端:git push --set-upstream origin lisi
复制代码
 
 
011、CTO将李四的文件进行合并
复制代码
1、更新本地端分支:git fetch --all

2、切换到子分子:git checkout lisi

3、切换到主分支:git checkout master

4、合并文件:git merge lisi

5、提交到远端:git push
复制代码

 

 

11、删除远端分支

 git push origin --delete <分支的名字>

 

12、删除本地分支

git branch -D  分支名称 

 

012、总结

复制代码
今后早上到公司第一件事:

    1、拉取最新的代码:git pull

晚上离开公司的第一件事

    1、提交代码:git push

Guess you like

Origin www.cnblogs.com/yebai/p/11326452.html