Skip to content

Commit

Permalink
update git scenario
Browse files Browse the repository at this point in the history
  • Loading branch information
stevensu1977 committed Oct 25, 2018
1 parent 064d5e9 commit 1f772ca
Show file tree
Hide file tree
Showing 2 changed files with 65 additions and 2 deletions.
60 changes: 59 additions & 1 deletion git-advanced/step3.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,62 @@ func main(){

在Step2中我们创建的dev分支,并且将它的改动合并到master分支, 但是我们这次实在dev分支下面修改了main.go这样在合并的时候就会产生冲突.

3.2 切换到master分支,(待续)
3.2 切换到master分支

`git checkout master`{{execute}}

`git merge dev` {{execute}}

注意现在git提供了一个Fast-Forward模式,尽量坚持冲突的发生

如果你希望看见上面的修改出现冲突请使用 `git merge --no-ff dev` {{execute}} ,'--no-ff'参数会让git禁止Fast-Foward 特性

```bash
#Fast-forward
/myproject # git merge dev
Updating 11b88f2..9b5ffbe
Fast-forward
main.go | 1 -
1 file changed, 1 deletion(-)


#Disable Fast-forward 模式
/myproject # git merge --no-ff dev
Auto-merging main.go
CONFLICT (content): Merge conflict in main.go
Automatic merge failed; fix conflicts and then commit the result.
/myproject # cat main.go
package main

import (
"log"
"fmt"
)

func main(){
log.Println("dev update version")
<<<<<<< HEAD
fmt.Println("add comment master agaion")
=======
fmt.Println("add comment dev1 agaion")
>>>>>>> dev
}


func other(){
//this comments
}
/myproject #

#修改冲突之后提交重新merge就好了
/myproject # git add main.go
/myproject # git merge --no-ff dev
fatal: You have not concluded your merge (MERGE_HEAD exists).
Please, commit your changes before you merge.
/myproject # git commit -m "master update"
[master 70f0b06] master update
/myproject # git merge --no-ff dev
Already up to date.
/myproject #
```

7 changes: 6 additions & 1 deletion git-startup/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,14 @@ services:
git_{OID}:
image: "flowq/git"
tty: true
cpu_shares: 0.5
cpu_rt_period: '500000'
mem_limit: '64m'
networks:
- {OID}

volumes:
- share:/data/share:ro
- {OID}:/data/work


networks:
Expand Down

0 comments on commit 1f772ca

Please sign in to comment.