Git Branch

New Branch is a different version of the Git project. It contains commits from master but also has commits that master does not have. 

1. Create a new branch
        git branch <branch_name>
2. Switch to the new branch:
        git checkout <branch_name>
        Once you switch branch, be now able to make commits on the branch that have no impact on master.
    You can continue your workflow, while master stays intact!
3. Switch back to master branch:
        git checkout master
4. Merge changes into master branch:
        git merge <branch_name>
5. Delete the new branch:

        git branch -d <branch_name>


generalizations

Let's take a moment to review the main concepts and commands from the lesson before moving on.

  • Git branching allows users to experiment with different versions of a project by checking out separate branches to work on.

The following commands are useful in the Git branch workflow.

  • git branch: Lists all a Git project's branches.
  • git branch branch_name: Creates a new branch.
  • git checkout branch_name: Used to switch from one branch to another.
  • git merge branch_name: Used to join file changes from one branch to another.
  • git branch -d branch_name: Deletes the branch specified.


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值