• git重写历史记录


    1 修改上一次历史提交,替换掉上次的提交
    git commit --amend

    2 git rebase 将不同分支路径合并到同一分支路径上
    eg:将master分支上的 conflic rebase合并到 head分支上
    * ada88de(HEAD, test_rebase)Initial commit on test_rebase
    | *2a4a11f (master) coflict rebase
    | /
    |/
    * ac75384 This is a amend commit


    $ git rebase master

    1 如果发生冲突 可以执行git rebase --abort撤销
    2 解决冲突 vim编辑冲突文件 ,
    3 git rebase --continue,
    4 git add 冲突文件,
    5 git rebase --continue

    结果:
    * ada88de(HEAD, test_rebase)Initial commit on test_rebase
    *2a4a11f (master) coflict rebase
    |
    |
    * ac75384 This is a amend commit

    如果像回到git rebase操作执行之前

    git reflog查看所有head记录

    使用git reset -- hard HEAD@{N} (N代表数字 )回到操作前的某一次提交

    git reset --soft commit 只将版本库中的head指向commit
    git reset --mixed commit 将版本库中的 head指向commit ,使用commit分支文件替换暂存去

    git reset --hard commit 版本库指向commit ,替换了暂存去和工作区

  • 相关阅读:
    C#——Unity事件监听器
    关于RAS加解密的工具类
    关于Map的源码分析之HashMap
    关于Map的源码分析
    关于Set的源码分析
    关于集合List的源码分析
    关于String源码分析
    hdu 1285 确定比赛名次
    hdu 2553 N皇后问题
    hdu 1312 Red and Black
  • 原文地址:https://www.cnblogs.com/or2-/p/4943996.html
Copyright © 2020-2023  润新知