zoukankan      html  css  js  c++  java
  • Git删除本地分支和远程分支

    https://blog.csdn.net/sub_lele/article/details/52289996

    git branch help

    λ git branch -h
    usage: git branch [<options>] [-r | -a] [--merged | --no-merged]
       or: git branch [<options>] [-l] [-f] <branch-name> [<start-point>]
       or: git branch [<options>] [-r] (-d | -D) <branch-name>...
       or: git branch [<options>] (-m | -M) [<old-branch>] <new-branch>
       or: git branch [<options>] [-r | -a] [--points-at]
    
    Generic options
        -v, --verbose         show hash and subject, give twice for upstream branch
        -q, --quiet           suppress informational messages
        -t, --track           set up tracking mode (see git-pull(1))
        --set-upstream        change upstream info
        -u, --set-upstream-to <upstream>
                              change the upstream info
        --unset-upstream      Unset the upstream info
        --color[=<when>]      use colored output
        -r, --remotes         act on remote-tracking branches
        --contains <commit>   print only branches that contain the commit
        --abbrev[=<n>]        use <n> digits to display SHA-1s
    
    Specific git-branch actions:
        -a, --all             list both remote-tracking and local branches
        -d, --delete          delete fully merged branch
        -D                    delete branch (even if not merged)
        -m, --move            move/rename a branch and its reflog
        -M                    move/rename a branch, even if target exists
        --list                list branch names
        -l, --create-reflog   create the branch's reflog
        --edit-description    edit the description for the branch
        -f, --force           force creation, move/rename, deletion
        --merged <commit>     print only branches that are merged
        --no-merged <commit>  print only branches that are not merged
        --column[=<style>]    list branches in columns
        --sort <key>          field name to sort on
        --points-at <object>  print only branches of the object
    

    创建分支

    Git branch yourbranch
    git checkout yourbranch
    
    # 创建并切换到分支
    git checkout -b yourbranch
    

    合并分支

    git checkout master
    git merge yourbranch
    

    git status查看哪些文件需要合并, 合并后提交.

    删除分支

    git branch -d yourbranch
    

    但是这个只是删除了本地分支, 远程的还在

    删除远程分支

    git push origin -d yourbranch
    

    分支未合并会提示合并

    若分支有修改还未合并,会提示你还没合并。
    强行删除本地分支:

    git branch -D Su-modify
    
  • 相关阅读:
    小爬麦子学院教师
    小爬糗事百科
    小爬需登录的网站之麦子学院
    小爬静态页面图片
    python正则表达式
    使用Coding.net+Hexo+node.js+git来搭建个人博客
    H5键盘事件处理
    获取页面高度等信息
    JavaScript实用的工具/类库
    DOM
  • 原文地址:https://www.cnblogs.com/wancy86/p/8661914.html
Copyright © 2011-2022 走看看