Linux安全网 - Linux操作系统_Linux 命令_Linux教程_Linux黑客

会员投稿 投稿指南 本期推荐:
搜索:
您的位置: Linux安全网 > Linux系统 > » 正文

GIT分支衍合实例

来源: 未知 分享至:

Git的衍合原理是,在两个分支同时提交更新,在一个分支衍合另外一个分支,相当于那对方的补丁来更新自己,而被衍合的分支不发生改变。

[root@localhost wanyan]# vi rebase1

[root@localhost wanyan]# cat rebase1

first

[root@localhost wanyan]# vi rebase2

[root@localhost wanyan]# cat rebase2

1

[root@localhost wanyan]# git init

Initialized empty Git repository in /git/wanyan/.git/

[root@localhost wanyan]# git add .

[root@localhost wanyan]# git commit -m '1st commint'

[master (root-commit) 9e8b3cd] 1st commint

 2 files changed, 2 insertions(+), 0 deletions(-)

 create mode 100644 rebase1

 create mode 100644 rebase2

 [root@localhost wanyan]# git branch laji

[root@localhost wanyan]# git branch

  laji

* master

[root@localhost wanyan]# git checkout laji

Switched to branch 'laji'

[root@localhost wanyan]# vi rebase1

[root@localhost wanyan]# cat rebase1

first

two

[root@localhost wanyan]# git commit -a -m "laji"

[laji 065adde] laji

 1 files changed, 1 insertions(+), 0 deletions(-)

[root@localhost wanyan]# git checkout master

Switched to branch 'master'

[root@localhost wanyan]# vi rebase2

[root@localhost wanyan]# cat rebase2

1

2

[root@localhost wanyan]# git commit -a -m "master"

[master ce848ae] master

 1 files changed, 1 insertions(+), 0 deletions(-)

[root@localhost wanyan]# git branch

  laji

* master

[root@localhost wanyan]# git checkout laji

Switched to branch 'laji'

[root@localhost wanyan]# git branch

* laji

  master

[root@localhost wanyan]# git rebase master

First, rewinding head to replay your work on top of it...

Applying: laji

[root@localhost wanyan]# cat rebase1

first

two

[root@localhost wanyan]# cat rebase2

1

2

[root@localhost wanyan]# git branch master

fatal: A branch named 'master' already exists.

[root@localhost wanyan]# git checkout  master

Switched to branch 'master'

[root@localhost wanyan]# cat rebase2

1

2

[root@localhost wanyan]# cat rebase2

1

2

[root@localhost wanyan]# cat rebase1

first

这个是单独的实例仅仅为了理解原理,无实践意义。

 


Tags:
分享至:
最新图文资讯
1 2 3 4 5 6
验证码:点击我更换图片 理智评论文明上网,拒绝恶意谩骂 用户名:
关于我们 - 联系我们 - 广告服务 - 友情链接 - 网站地图 - 版权声明 - 发展历史