1, Git branch
Branch can provide the user with multiple environments, which means you can take your work separated from the main line of development, so as not to affect the main line of development.
Phase IV: Mall & emergency repair bug
bug ideas emergency repair line:
When C3 version of the software began to expand the new features of version produced C4, C4 version but this time there is a new bug, namely C5, C5 with this branch in emerging bug fixes, and then two branches: branch C5 bug fixes and software version on the normal line of C6 combined into a complete repair software version of C7.
based online bug fix branch
currently located in your branch
git branch
Creating a branch
git branch branch name
Switching branch
git checkout branch name
Branches merge (potential conflict)
git merge to merge the branch
consolidation time if something goes wrong, you can manually delete the wrong tags section .
Deleted branches
git branch -d branch name
Prior to the merger, it is necessary to switch to the main branch:
2、GitHub
Phase V -> to enter the Sanlitun
First, the need to register github account and create a remote repository, and then run the following command to upload the code to github.
To a remote warehouse surnamed
git remote add origin remote warehouse address
Push code to the remote
git push -u origin branch
For the first time in the company's new computer to download the code
clone remote repository Code
git clone a remote repository address
Switching branch
git checkout branch
After you download the code for the company to continue to develop
to switch to the dev branch development
git checkout dev
The master branch into dev (Update branch code files into a master code file saved latest online)
git merge master
Submit code
git add .
git commit -m “xxx”
git push origin dev
Completion of the development, to be on-line
to dev branches merged into master, carried out on-line
git checkout master
git merge dev
git push origin master
The branch also pushed to the remote dev
git checkout dev
git merge master
git push origin dev
Special case: Forget submit code
Pull Code
git pull origin dev
Submit code
git add .
git commit -m “xxx”
Note that at this time did not submit to GitHub hosting
Home to continue to write code
to pull the code, found no company code
git pull origin dev
But unfortunately, we continue to develop other functions
to be pushed to the remote branch dev
git add .
git commit -m “xxx”
git push origin dev
The company continues to write code to
pull the code, the code yesterday pulled the local (there may be a conflict)
git pull origin dev
Resolve conflicts, continue to develop this method of conflict resolution is a direct manually remove the abnormal part of the code, and then save out
The branch also pushed to the remote dev
git add .
git commit -m “xxx”
git push origin dev