-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Description
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
- master branch
- commit 1
- commit 2
- commit fromMasterBran
- test branch
- commit 1
- commit 2
- commit fromTestBran
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.
- master branch
- commit 1
- commit 2
- commit fromMasterBran
- commit checkout conflict
then git merge testBran
- master branch
- commit 1
- commit 2
- commit fromMasterBran
- commit fromTestBran
- commit checkout conflict
- test branch
- commit 1
- commit 2
- commit fromTestBran
git only saves changes, do not let them conflict before merge them.
- commit fromMasterBran mean
add changes to hello.txtcompare to commit 2 - commit fromTestBran mean
add changes to hello.txtcompare to commit 2 - commit checkout conflict mean
figure conflict to above twocompare to commit 2
It's fine!
delete branch
normal delete
git branch -d branName
force delete
git branch -D branName
Metadata
Metadata
Assignees
Labels
No labels