【github】github 创建新分支 git branch

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/xiaoxiao133/article/details/83502652

git branch

一、新建分支操作代码示例如下:

0、仓库克隆
github clone https://github.com/XiaoGongWei/TESTGIT
1、// 创建新分支
git branch -c xiaogongwei_v1.0
2、切换到新分支
git checkout xiaogongwei_v1.0
3、列出所有分支
git branch -a
4、新增加文件
vim xiao_add.c
然后写一点文字进去
5、提交到新的仓库xiaogongwei_v1.0,更新本地文件到远程xiaogongwei_v1.0
git add xiao_add.c
git commit -am “xiaogongwei add files”
git push origin xiaogongwei_v1.0

二、合并分支

  1. 切换到master(主分支)
    git checkout master
  2. 合并分支xiaogongwei_v1.0(子分支)
    git merge --no-ff xiaogongwei_v1.0
  3. 提交注释,
    git commit -am “merage affect REAMD.md
  4. 上传更新
    git push

猜你喜欢

转载自blog.csdn.net/xiaoxiao133/article/details/83502652