Git Squash by author - All author commits into a single commit

后端 未结 3 1628
鱼传尺愫
鱼传尺愫 2020-12-19 05:31

I am trying squash many commits into a single one, the problem is that I need do that by author (name or email).

The case:

Lets say I have a branch called fe

3条回答
  •  被撕碎了的回忆
    2020-12-19 06:20

    Be careful rewriting history

    The end result you want might be possible if you create branches for each author, cherry-pick the commits from each author into the right branch, then squash those changes. However, I don't think that will work if these commits meaningfully depend on each other.

    If you have a series of commits:

                Author1                Author2                Author1
    version1 ---commit---> version2 ---commit---> version3 ---commit--->...
    

    If you were to try to extract the changes from Author2, and apply them to version1, there's a good chance it won't make sense (For example, if Author2 modifies code that Author1 created).

提交回复
热议问题