Twisting all my commits (including merges) into one message without changing the history

Let's say I have 100 commits in my branch that I have been working on for 3 weeks. Sometimes (every day, actually) I reach from the beginning / master and merge it into my branch.

How could I (easily) start crushing all my commits into one commit without messing up the story? If I somehow twist all my commits, can I destroy the merged source / magic thrusts when my transfer request is moved to the beginning / master?

+1
source share
1 answer

“Twisting” and “preserving history” are roughly the exact opposite in terminology.

If you mean that you want to make one commit that includes only your changes, and not those that are in the master, you probably want to rebase to the source / master, and then format it. You can do all this from a single interactive redirect call:

 git fetch origin git rebase -i origin/master 

and then change all the lines after the first from pick to squash .

+8
source

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


All Articles