1. Set git global User Configuration
# git config--global user.name "xxx"
# git config--global user.email [email protected]
2. Create a new local project working tree
# mkdir New-project
# CD New-project
# git Init
# Touch README
# git Add README
# git commit-m ' first commit '
To define a remote server alias origin
# git remote add origin [email protected]:xxx/new-project.git
Local and remote merge, local default branch is master
# Git push Origin Master
You can see it on the GitHub website, Http://github.com/xxx/new-project.
3. Update files
# VI README
Automatic commit Change file
# git Commit-a
Update to remote
# Git push Origin Master
4. Create and Merge Branches
#git Branch shows that the current branch is master
Create a branch #git branch new-feature
# git checkout new-feature switch to new branch
# VI page_cache.inc.php
# git Add page_cache.inc.php
Commit to local git
# git commit-a-M "added initial version of page cache"
Merging to a remote server
# Git push Origin new-feature
If the New-feature branch matures, it feels necessary to merge into Master
#git Checkout Master
#git Merge New-feature
#git Branch
#git push
The New-feature code is also incorporated in master
Log on to GitHub again to see the branching options under "Switch Branches":
Reproduced the http://blog.csdn.net/richardysteven/article/details/5956854 content.
"Go" GitHub use