zoukankan      html  css  js  c++  java
  • git branch & checkout fetch 的使用和冲突解决

    git branch & checkout fetch 的使用和冲突解决

    branch

    git branch    查看本地分支

    git branch -v     查看本地分支的具体信息(commit id,例如:f65ded9 和 commit 信息)

    git branch -r   查看远程分支

    git branch -a     查看本地和远程分支

    git branch -vv         查看本地分支和远程分支的对应关系

     

    git branch <new-branch-name>          新建本地分支

    git branch <new-branch-name> <commit id>     给 commit id 新建一个分支

    git branch -d <branch-name> [<branch-name>]     删除(多个)本地分支

    git branch -m <new-anem>            在当前分支中修改当前分支的名字

    checkout & branch

    git checkout <branch-name>  切换到另外的一个分支

    fetch & branch

    git fetch origin master:<name-branch-name>  抓取远程仓库 origin 的 master 分支到本地的一个新分支<name-branch-name>

    git diff <branch-name>             查看分支<branch-name>和当前分支的差异

    git merge <branch-name>          融合分支<branch-name>到当前分支

    merger冲突

    如果当前分支和 merge 的分支有冲突(修改了同一个文件),而且当前分支没有 commit 过,就会提示先 commit,再 merge,这时候 merge 会提示那些冲突的文件自动合并失败,并让我们手动修复后在 commit 一次,在冲突的文件中会有类似以下内容:

    <<<<<<< HEAD:index.html
    <div id="footer">contact : email.support@github.com</div>
    =======
    <div id="footer">
    please contact us at support@github.com
    </div>
    >>>>>>> iss53:index.html

    修改后:

    git add -A

    git commit -m 'fix confliction'

    git push

  • 相关阅读:
    prometheus TSDB和外部存储系统
    Prometheus时序数据
    Prometheus简介
    Docker网络
    Ingress
    CRI和多容器运行时
    K8s容器存储接口(CSI)介绍
    EasyNVR视频广场点击视频后切换码流才能播放是什么原因?
    EasyNVR更新H265转H264模块内存增长且显示占用高如何解决?
    EasyNVR拉公网RTSP流失败问题调试和解决
  • 原文地址:https://www.cnblogs.com/ibingshan/p/10374101.html
Copyright © 2011-2022 走看看