Git

Git系列4:git merge合并操作

2020-01-01  本文已影响0人  XBruce

Fast forward merge

image.png

步骤:

git checkout master
#fast forward merge
git merge featureX
#no ff:   git merge --no-ff featureX
git branch -d featureX

解决Merge冲突

$ git log --oneline --graph --all
* bc6f532 (HEAD -> master) from master
| * 5598e7d (featureX) test git merge conflict
|/
*   0f03a6a Merge branch 'featureY'
|\
| * 44591ba test add featureY
|/
*   91ee5aa (origin/master) Merge branch 'branch1'

$ git merge featureX
Auto-merging filea.txt
CONFLICT (content): Merge conflict in filea.txt
Automatic merge failed; fix conflicts and then commit the result.

$ git status
On branch master
Your branch is ahead of 'origin/master' by 3 commits.
 (use "git push" to publish your local commits)

You have unmerged paths.
 (fix conflicts and run "git commit")
 (use "git merge --abort" to abort the merge)

Unmerged paths:
 (use "git add <file>..." to mark resolution)

       both modified:   filea.txt

no changes added to commit (use "git add" and/or "git commit -a")

$ git add filea.txt

$ git commit
[master b1a2fd9] Merge branch 'featureX'

$ git push
Counting objects: 11, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (8/8), done.
Writing objects: 100% (11/11), 1.05 KiB | 154.00 KiB/s, done.
Total 11 (delta 2), reused 0 (delta 0)
To https://bitbucket.org/bigbruce/hellogit.git
  91ee5aa..b1a2fd9  master -> master
上一篇 下一篇

猜你喜欢

热点阅读