Running filter-branch over a range of commits

前端 未结 8 1321
夕颜
夕颜 2020-12-02 14:26
git filter-branch --env-filter \'
export GIT_AUTHOR_EMAIL=\"foo@example.com\"
export GIT_AUTHOR_NAME=\"foo\"\' -- commita..commitb

Results in

8条回答
  •  醉梦人生
    2020-12-02 14:56

    I do it this way.

    Let's say you want to filter the content of a branch called branch-you-are-filtering.

    Assume that there's an ancestor commit to that branch, with a ref called ref-for-commit-to-stop-at.

    git filter-branch --commit-filter 'YOUR_FILTER_COMMANDS' branch-you-are-filtering...ref-for-commit-to-stop-at
    

    After executing, the commit at ref-for-commit-to-stop-at will not be altered. All the filtered\changed commits in branch branch-you-are-filtering will be based on ref-for-commit-to-stop-at.

    Whether or not you're using --commit-filter or something else is up to you.

提交回复
热议问题