在一系列提交中运行filter-branch [英] Running filter-branch over a range of commits

查看:76
本文介绍了在一系列提交中运行filter-branch的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

  git filter-branch --env-filter'
export GIT_AUTHOR_EMAIL =foo@example.com
export GIT_AUTHOR_NAME =foo' - commita ..commitb

结果在您要重写哪个ref? $ b

所以看起来 filter-branch 不允许使用范围表示法使用两个任意引用之间的范围。



在连续提交范围内运行过滤器的最直接方法是什么如果这种方法是不可能的话。

解决方案

我找到的最干净的解决方案是: / p>


  1. refb 处创建一个临时分支。

  2. refa..temp 中应用分支过滤器。

  3. 重新绑定到临时分支并删除它。



  4. ie

      git branch temp refb 

    git filter-branch --env-filter'
    export GIT_AUTHOR_EMAIL =foo@example.com'refa..temp

    git rebase temp
    git branch --delete temp


    git filter-branch --env-filter '
    export GIT_AUTHOR_EMAIL="foo@example.com"
    export GIT_AUTHOR_NAME="foo"' -- commita..commitb
    

    Results in Which ref do you want to rewrite?

    So it seems that filter-branch doesn't allow you to use range notation use a range between two arbitrary refs.

    What is the most straight forward way of running a filter over a range of consecutive commits (somewhere within the history of a branch) if this approach isn't possible.

    解决方案

    The cleanest solution I found was to do the following:

    1. Create a temporary branch at refb.
    2. Apply the branch filter on refa..temp.
    3. Rebase onto the temporary branch and delete it.

    ie.

    git branch temp refb
    
    git filter-branch --env-filter '
    export GIT_AUTHOR_EMAIL="foo@example.com"' refa..temp
    
    git rebase temp
    git branch --delete temp
    

    这篇关于在一系列提交中运行filter-branch的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆