git 分支的基本操作

来源:互联网 发布:windows cacti 不出图 编辑:程序博客网 时间:2024/06/04 17:46
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
0 0
原创粉丝点击