git: squash/fixup earlier commit

前端 未结 6 1177
野的像风
野的像风 2020-12-03 01:42

Suppose you have:

A-B-C

Now your build/test fails. The fix should be merged in A. My current work-flow is like this:

$ git         


        
6条回答
  •  难免孤独
    2020-12-03 02:04

    My current git work flow is so --fixup/--squash intensive, that I wrote a new git-fixup command that handles most of the annoying bits automatically:

    • git fixup shows the modified files grouped under that latest commits that touch the same files
    • git fixup -a commits all those changes as --fixup changes with their corresponding "parent" commits
    • git fixup -r does an automatic git rebase --autosquash for all the fixup commits

    A lot of changes are such that just the three commands above are enough to get the job done, no copy-pasting of commit-id's or reading thru the git log to find the right --fixup targets.

    Source: https://github.com/ohmu/git-crust

提交回复
热议问题