概述

在开发新需求的时候, 会基于Master分支拉取新的分支,然后在新的分支进行开发.

操作步骤和说明

新建分支命令说明:

git checkout -b refund_in_advance # 检出一个名字为 refund_in_advance 的分支
git push —set-upstream origin refund_in_advance 推到远端一个名字为 refund_in_advance 的分支

在项目文件夹根目录下进行操作:

  1. PS E:\YeWuZhongTai\fh-oms\fh-oms> git checkout -b refund_in_advance
  2. Switched to a new branch 'refund_in_advance'
  3. M README.md
  4. M oms-core/oms-core-service/oms-reverse-service/src/main/java/com/alibaba/oms/core/service/reverse/api/impl/ReverseBasePortalServiceImpl.java
  5. PS E:\YeWuZhongTai\fh-oms\fh-oms> git push --set-upstream origin refund_in_advance
  6. Total 0 (delta 0), reused 0 (delta 0)
  7. To https://codeup.aliyun.com/5ee31556360ec3ecf8980cd5/firmus/fh-oms.git
  8. * [new branch] refund_in_advance -> refund_in_advance
  9. Branch 'refund_in_advance' set up to track remote branch 'refund_in_advance' from 'origin'.
  10. PS E:\YeWuZhongTai\fh-oms\fh-oms>

查看效果

发现本地已经自动切换到了这个分支了

Git新建本地分支和远端分支 - 图1

发现远端已经有了这个分支了

Git新建本地分支和远端分支 - 图2