yuanchongjie
git分支的基本操作。

创建私有分支:
    $git branch branchName commitID
    $git checkout -b branchName commitID
注意:git checkout -b branchName commitID = git branch branchName commitID + git checkout branchName。

合并分支(合并前需要切换到目标分支):
    $git merge sourceBranch
    $git cherry-pick commitID

查看分支:
    $git branch (-a) (-r)
    $git branch --merged 查看合并到当前分支的所有分支
    $git branch --no-merged 查看还没有合并到当前分支的所有分支

删除私有分支:
    $git branch -d/-D branchName
    -d:检查是否合并到其它分支/-D: 不检查强制删除

重命名分支:
    $git branch -m oldBranch newBranch

分类:

技术点:

相关文章:

  • 2021-07-28
  • 2021-09-20
  • 2021-06-05
  • 2022-12-23
  • 2022-12-23
  • 2021-12-16
  • 2021-12-22
  • 2021-10-16
猜你喜欢
  • 2021-10-12
  • 2022-12-23
  • 2021-10-23
  • 2022-02-09
  • 2021-05-01
相关资源
相似解决方案