Twisting and reorganization

I saw a lot of blog posts about using git commit --amend , or rewriting for squash lumps.

It’s a little easier for me to git reset to the last checkpoint (say, before all my point saving microcommands), and then use the interactive add to select the best fix order.

Is there a flaw in this?
I am wondering how b / c is, since most of the blogs I read use to fix or reinstall for this purpose.

+4
source share
2 answers

The downside is that you select all the individual files again to group them again into commits.

If your commits should be grouped (without the need to add or delete files in these commits), then reinstalling is interactive easier: you reason from the point of view of the set of files. In fact, with the right to comment on comments, rebase --interactive --autosquash can reorder for you.

If your commits are purely an intermediate savepoint, not counting their composition in terms of a set of files, then your solution is adequate.

+6
source

To add to what VonC answered, it depends on how many commits you have.

What happens to me most often is something like this:

  • Work on A, commit
  • Work on B, commit
  • Oh no! I missed something important in A, fixed a fix for A

With interactive permutation, it is trivial to reorder and then dig the patch into the original commit for A.

Another example is when I just want to rewrite the commit message.

Another example: when I have something like this

 A-------------------master \ B-----C-----D-----branch 

and I want to include C and D, but not B in master. I can use rebase to reorder my branches to C, D, B, then git checkout master and git merge D

+3
source

Source: https://habr.com/ru/post/1346191/


All Articles