Chinaunix首页 | 论坛 | 博客
  • 博客访问: 724565
  • 博文数量: 77
  • 博客积分: 0
  • 博客等级: 民兵
  • 技术积分: 1173
  • 用 户 组: 普通用户
  • 注册时间: 2014-05-16 11:20
个人简介

将技术做到极致...

文章分类

全部博文(77)

文章存档

2019年(3)

2015年(27)

2014年(47)

分类: 项目管理

2019-02-15 10:27:27

需求描述:
    公司小明想在远程的A.git项目的a分支基础上新建一个B.git项目,在B.git项目上可以看到A.git项目的a分支的所有提交记录。

方法步骤:
    1)查看A项目分支,我这里以BCOS项目的3.0.5分支为例,如下:

点击(此处)折叠或打开

  1. chenfm@4438fad59b85:~/BCOS$ git branch -a
  2.   3.0.3
  3.   3.0.4
  4. * 3.0.5
  5.   3.0.6
  6.   GW200-2018120519-Release
  7.   devel-2.6
  8.   master
  9.   remotes/origin/3.0.1
  10.   remotes/origin/3.0.2
  11.   remotes/origin/3.0.3
  12.   remotes/origin/3.0.4
  13.   remotes/origin/3.0.5
  14.   remotes/origin/3.0.6
    2)查看3.0.5分支的提交记录,用于后面对照:

点击(此处)折叠或打开

  1. chenfm@4438fad59b85:~/BCOS$ git log
  2. commit 952ecbf89bf2040ea4282c14f20e2999e70c96b1
  3. Author: chenfm <chenfanming@ruijie.com.cn>
  4. Date: Wed Jan 30 10:36:53 2019 +0800

  5.     <E5><BA><94><E7><94><A8><E6><B5><81><E9><87><8F><E3><80><81><E7><94><A8><E6><88><B7><E6><B5><81><E9><87><8F><E9><80><9F><E7><8E>

  6. commit d0ffc016bd80098a720719808e6006e4e77ae513
  7. Author: chenfm <chenfanming@ruijie.com.cn>
  8. Date: Tue Jan 29 16:09:05 2019 +0800

  9.     <E6><98><93><E7><94><A8><E6><80><A7><E6><94><B9><E8><BF><9B>bug<EF><BC><9A>1225<EF><BC><8C><E7><BA><BF><E8><B7><AF><E6><B5><81>

  10. commit ff6636de3c81c0e131313830adcf1271d5baa187
  11. Author: zhuliangyou <zhuliangyou@ruijie.com.cn>
  12. Date: Fri Jan 25 17:41:06 2019 +0800

  13.     fixed snmp v3 get index Maybe no result.

  14. commit 8879b89ff646d3e6fb9b74a9e14a48200457ef68
  15. Author: zhuliangyou <zhuliangyou@ruijie.com.cn>
  16. Date: Fri Jan 25 11:11:20 2019 +0800

  17.     fixed weixin scan can't jump

  18. commit 97c3300f0cca59b7aa0b3facebe9bacc516ddbd5
  19. Author: zhuliangyou <zhuliangyou@ruijie.com.cn>
  20. Date: Thu Jan 24 18:43:44 2019 +0800

  21.     fixed snmp v3 support

  22. commit b7e472460f3654edbc84069d018844e7050fa649
  23. Author: zhuliangyou <zhuliangyou@ruijie.com.cn>
  24. Date: Thu Jan 24 09:47:03 2019 +0800

  25.     fixed snmp can't create cache for webauth

  26. commit ef971d8793170e330762880d6348095edb60ec3e
  27. Author: chenfm <chenfanming@ruijie.com.cn>
  28. Date: Thu Jan 17 17:24:22 2019 +0800
    3)创建B项目,创建过程我这边不做描述,我这里以我已经创建好的test项目为例新建1.0分支

点击(此处)折叠或打开

  1. chenfm@4438fad59b85:~/devel/identify/test$ git branch -a
  2. * master
  3.   remotes/origin/HEAD -> origin/master
  4.   remotes/origin/master
    4)在B项目添加A项目分支信息

点击(此处)折叠或打开

  1. chenfm@4438fad59b85:~/devel/identify/test$ git branch -a //下面只有master分支
  2. * master
  3.   remotes/origin/HEAD -> origin/master
  4.   remotes/origin/master
  5. chenfm@4438fad59b85:~/devel/identify/test$ git remote add -f BCOS /home/chenfm/BCOS //(BCOS为A项目名称,/home/chenfm/BCOS为A项目路径)
  6. Updating BCOS
  7. warning: no common commits
  8. remote: Counting objects: 21542, done.
  9. remote: Compressing objects: 100% (14824/14824), done.
  10. remote: Total 21542 (delta 4955), reused 20476 (delta 4352)
  11. Receiving objects: 100% (21542/21542), 20.24 MiB | 22.64 MiB/s, done.
  12. Resolving deltas: 100% (4955/4955), done.
  13. From /home/chenfm/BCOS
  14.  * [new branch] 3.0.3 -> BCOS/3.0.3
  15.  * [new branch] 3.0.4 -> BCOS/3.0.4
  16.  * [new branch] 3.0.5 -> BCOS/3.0.5
  17.  * [new branch] 3.0.6 -> BCOS/3.0.6
  18.  * [new branch] GW200-2018120519-Release -> BCOS/GW200-2018120519-Release
  19.  * [new branch] devel-2.6 -> BCOS/devel-2.6
  20.  * [new branch] master -> BCOS/master
  21. chenfm@4438fad59b85:~/devel/identify/test$ git branch -//再次查看B项目分支,发现多出了A项目的分支
  22. * master
  23.   remotes/BCOS/3.0.3
  24.   remotes/BCOS/3.0.4
  25.   remotes/BCOS/3.0.5
  26.   remotes/BCOS/3.0.6
  27.   remotes/BCOS/GW200-2018120519-Release
  28.   remotes/BCOS/devel-2.6
  29.   remotes/BCOS/master
  30.   remotes/origin/HEAD -> origin/master
  31.   remotes/origin/master
  32. chenfm@4438fad59b85:~/devel/identify/test$

    5)在B项目上创建1.0分支

点击(此处)折叠或打开

  1. chenfm@4438fad59b85:~/devel/identify/test$ git checkout -b 1.0 BCOS/3.0.//1.0为要新建的分支,BCOS/3.0.5为基础分支
  2. Branch 1.0 set up to track remote branch 3.0.5 from BCOS.
  3. Switched to a new branch '1.0'
  4. chenfm@4438fad59b85:~/devel/identify/test$ git branch -a  //这个时候1.0还只是在本地
  5. * 1.0
  6.   master
  7.   remotes/BCOS/3.0.3
  8.   remotes/BCOS/3.0.4
  9.   remotes/BCOS/3.0.5
  10.   remotes/BCOS/3.0.6
  11.   remotes/BCOS/GW200-2018120519-Release
  12.   remotes/BCOS/devel-2.6
  13.   remotes/BCOS/master
  14.   remotes/origin/HEAD -> origin/master
  15.   remotes/origin/master
  16. chenfm@4438fad59b85:~/devel/identify/test$ git push origin 1.0 //提交1.0分支到远程仓库
  17. Counting objects: 21382, done.
  18. Delta compression using up to 24 threads.
  19. Compressing objects: 100% (14207/14207), done.
  20. Writing objects: 100% (21381/21381), 20.22 MiB | 2.03 MiB/s, done.
  21. Total 21381 (delta 4857), reused 21332 (delta 4818)
  22. remote: Resolving deltas: 100% (4857/4857), done.
  23. To git@git.dev.tencent.com:cfm5538/test.git
  24.  * [new branch] 1.0 -> 1.0
  25. chenfm@4438fad59b85:~/devel/identify/test$ git branch -//这个时候在B项目就可以看到1.0分支了
  26. * 1.0
  27.   master
  28.   remotes/BCOS/3.0.3
  29.   remotes/BCOS/3.0.4
  30.   remotes/BCOS/3.0.5
  31.   remotes/BCOS/3.0.6
  32.   remotes/BCOS/GW200-2018120519-Release
  33.   remotes/BCOS/devel-2.6
  34.   remotes/BCOS/master
  35.   remotes/origin/1.0    //远程仓库已经可以看到新建的分支
  36.   remotes/origin/HEAD -> origin/master
  37.   remotes/origin/master
  38. chenfm@4438fad59b85:~/devel/identify/test$
    6)现在我们查看一下B项目的1.0分支是否包含A项目的3.0.5分支的所有提交记录,跟步骤2对照一下

点击(此处)折叠或打开

  1. chenfm@4438fad59b85:~/devel/identify/test$ git log
  2. commit 952ecbf89bf2040ea4282c14f20e2999e70c96b1
  3. Author: chenfm <chenfanming@ruijie.com.cn>
  4. Date: Wed Jan 30 10:36:53 2019 +0800

  5.     <E5><BA><94><E7><94><A8><E6><B5><81><E9><87><8F><E3><80><81><E7><94><A8><E6><88><B7><E6><B5><81><E9><87><8F><E9><80><9F><E7><8E>

  6. commit d0ffc016bd80098a720719808e6006e4e77ae513
  7. Author: chenfm <chenfanming@ruijie.com.cn>
  8. Date: Tue Jan 29 16:09:05 2019 +0800

  9.     <E6><98><93><E7><94><A8><E6><80><A7><E6><94><B9><E8><BF><9B>bug<EF><BC><9A>1225<EF><BC><8C><E7><BA><BF><E8><B7><AF><E6><B5><81>

  10. commit ff6636de3c81c0e131313830adcf1271d5baa187
  11. Author: zhuliangyou <zhuliangyou@ruijie.com.cn>
  12. Date: Fri Jan 25 17:41:06 2019 +0800

  13.     fixed snmp v3 get index Maybe no result.

  14. commit 8879b89ff646d3e6fb9b74a9e14a48200457ef68
  15. Author: zhuliangyou <zhuliangyou@ruijie.com.cn>
  16. Date: Fri Jan 25 11:11:20 2019 +0800

  17.     fixed weixin scan can't jump

  18. commit 97c3300f0cca59b7aa0b3facebe9bacc516ddbd5
  19. Author: zhuliangyou <zhuliangyou@ruijie.com.cn>
  20. Date: Thu Jan 24 18:43:44 2019 +0800

  21.     fixed snmp v3 support

  22. commit b7e472460f3654edbc84069d018844e7050fa649
  23. Author: zhuliangyou <zhuliangyou@ruijie.com.cn>
  24. Date: Thu Jan 24 09:47:03 2019 +0800

  25.     fixed snmp can't create cache for webauth

end,谢谢!!!


阅读(54683) | 评论(0) | 转发(1) |
给主人留下些什么吧!~~