• git pull --rebase


    git pull --rebase What’s happening here? Git will rewind (undo) all of your local commits, pull down the remote commits then replay your local commits on top of the newly pulled remote commits. If any conflicts arise that git can’t handle you’ll be given the opportunity to manually merge the commits then simply run git rebase --continue to carry on replaying your local commits.

    福音: 把本地的commits放到remote commit的上面,一定程度上避免了交叉感染

    Tell git to always rebase when pulling, to do this on a project level add this to your .git/config file:

    1
    2
    
    [branch “master”]
      rebase = true

    Or do it all on the command line with git config branch.master.rebase true

    Add a global config option to always rebase when pulling

    1
    2
    
    [branch]
      autosetuprebase = always

    Or again do it all on the command line with git config --global branch.autosetuprebase always

    1. And the final way, which is what I personally use, in ~/.gitconfig

      1
      2
      
      [alias]
        pl = pull —rebase
      I have a bunch of aliases setup so I can type less and save myself those valuable microseconds. This will allow you to type git pl (or in my case g pl as I have git aliased to g) and it will automatically rebase. If I want to do a pull and not rebase for a specific reason I can use the command git pull which will do an pull without rebaseing.

    Of course you could use the 3rd solution and run the command git pull --no-rebase but that involves more typing, and I’m a lazy typer!

    /// GIT ALIAS 福利

    http://kernowsoul.com/blog/2012/06/20/4-ways-to-avoid-merge-commits-in-git/

  • 相关阅读:
    多线程关键字
    Atomic原子类
    FFmpeg滤镜代码级分析
    YUV420数据和字符信息如何利用滤镜方法进行编码?
    FFmpeg音视频编解码实践总结
    Android高手应该精通哪些内容
    CentOs 设置静态IP 方法
    花了5天时间,终于解决了一个bug,心情非常愉快,憋了这么久,不吐不快
    H264视频通过RTMP直播
    程序移植到VS2010,编译成功但是无法启动lib文件
  • 原文地址:https://www.cnblogs.com/qinqiu/p/9177871.html
Copyright © 2020-2023  润新知