zoukankan      html  css  js  c++  java
  • git及gitflow命令备忘

    全文xxx表示你的分支名

    一、git

    删除本地分支

    git branch -d xxx
    

    删除远程分支

    git push origin --delete xxx
    

    查看所有分支

    本地分支

    git branch
    

    本地及远程分支

    git branch -a
    

    所有分支的情况

    git remote show origin
    

    删除远端已删除但仍显示的分支

    git remote prune origin
    

    代码合并

    先切换到合并后分支,例如develop

    git checkout develop
    

    再同步远端代码

    git pull origin develop
    

    再合并指定分支代码到当前分支

    git merge --no-ff xxx
    

    再提交到远端

    git push origin devleop
    

    二、gitflow

    开始一个feature

    git flow feature start xxx
    

    结束一个feature

    git flow feature finish xxx
    

    会将此feature分支代码合并到develop,并删除这个feature
    相当于

    $ git checkout develop
    $ git merge --no-ff feature/xxx
    $ git branch -d feature/xxx
    

    开始一个release

    git flow release start xxx
    

    结束一个release

    git flow release finish xxx
    

    会将代码 merge到 master和 develop分支,并删除这个release
    举例,当前开发版本为v1.1.0,相当于

    $ git checkout master
    $ git merge --no-ff release/xxx
    $ git tag -a v1.1.0
    $ git checkout develop
    $ git merge --no-ff release/xxx
    $ git branch -d release/xxx
    

    push 主干 master 分支,并打 tag

    $ git checkout master
    $ git push
    $ git push origin v1.1.0
    

    push 开发 develop 分支

    $ git checkout develop
    $ git push
    
  • 相关阅读:
    LeetCode Best Time to Buy and Sell Stock
    LeetCode Scramble String
    LeetCode Search in Rotated Sorted Array II
    LeetCode Gas Station
    LeetCode Insertion Sort List
    LeetCode Maximal Rectangle
    Oracle procedure
    浏览器下载代码
    Shell check IP
    KVM- 存储池配置
  • 原文地址:https://www.cnblogs.com/diffx/p/11131495.html
Copyright © 2011-2022 走看看