hub-killer / git-notes

learning how to use git
0 stars 0 forks source link

Branch #6

Open bitfishxyz opened 5 years ago

bitfishxyz commented 5 years ago

show branches list

git branch

create new brancj

git branch newBranchName

change branch

git checkout branchName

merge branch

git merge targetBranchName

if it is comfilct

they all change hello.txt in third commit change, how to deal with when you are trying git merge testBranch?

it will fail merge, and change you hello.txt in working dir.

<<<<<<< HEAD
bbbbb
=======
aaaa
>>>>>>> testBran

you have to add a commit to master branch till this comfilct is not exist.

then git merge testBran

git only saves changes, do not let them conflict before merge them.

It's fine!

delete branch

normal delete

git branch -d branName

force delete

git branch -D branName