2020年11月9日星期一

About git branch

git init 
git config --global user.email "username@domail.com"
git config --global user.name "username"

git add .
git commit -m "commit comment"
git push -u local-branch remote-branch

git branch b01 #create a new branch named b01
git branch b02 #create a new branch named b02 

git checkout b01 #switch current branch to b01
git add newfile1.txt #add a newfile1.txt in b01

git checkout b02 #switch current branch to b02
git add newfile2.txt #add a newfile2.txt in b02
git commit -m "commit newfile2.txt for added."

git checkout b01 #switch current branch to b01
git commit -m "commit newfile1.txt for added"
git push  # push b01.local b01-> remote b01.

git checkout master #switch current branch to master
git merge b01 #local merge b01 to master
git push  # push merged master to remote master.