zoukankan      html  css  js  c++  java
  • git使用心得

    一、创建新的分支,并且切换到新的分支

    git checkout -b DEV2

    二、关于git-merge 的 --no-ff 参数的使用

    三 git log的使用

    git log --graph --pretty=oneline --abbrev-commit    //产生树状图

    git log --pretty=oneline    //一行显示

    四、查看分支和删除分支

    git branch   //查看本地分支
    git branch -a //查看所有分支 包括本地和远程
    git branch -d DEV2 //删除DEV2这个分支

    一旦删除的信息,git log的树形结构里就不会出现被删除的分支名,但是提交信息还在

     五、保存工作现场  

    git stash   //保存工作现场,然后切换到其他分支做其他到事情
    git stash list //查看工作现场保存到哪里去了


    git stash pop //恢复工作现场, 恢复的同时把stash内容也删了 (法一)
    git stash apply //恢复 git stash drop //删除 (法二)

     

    六、创建远程分支 

    git checkout -b develop   //本地创建并且切换到新分支 develop
    git push origin develop //远程就有develop分支

    此时本地有两个分支,远程也有两个分支,这时执行git pull 就会报错,因为不知道本地要拉取远程的哪个分支,下图明确说明本地分支和远程分支如何建立联系

     master出现问题  (1)出分支 issue01_a_b_c

            (2)在issue01_a_b_c修复bug,然后commit,记下commitID

            (3)在master分支上合并issue01_a_b_c,git merge --no-ff -m 'XXXX'  issue01_a_b_c

              (4) 切换到develop,拉出一个分支DEV-issue01_a_b_c

            (5)然后  git cherry-pick commitID

            (6)切换到develop,然后git merge

     

     

  • 相关阅读:
    D. Babaei and Birthday Cake--- Codeforces Round #343 (Div. 2)
    Vijos P1389婚礼上的小杉
    AIM Tech Round (Div. 2) C. Graph and String
    HDU 5627Clarke and MST
    bzoj 3332 旧试题
    codeforces 842C Ilya And The Tree
    codesforces 671D Roads in Yusland
    Travelling
    codeforces 606C Sorting Railway Cars
    codeforces 651C Watchmen
  • 原文地址:https://www.cnblogs.com/emma-post/p/10579307.html
Copyright © 2011-2022 走看看