How is squash fixed in one branch?

I made a trunk branch and submitted / made many changes. Each time, I often updated the branch by merging with the trunk (for example, 20 commits, then merge-update, another 20 commits, then merge-update, etc.).

Now I would like to crush everything in my branch. How to do it (using either the Git Extensions or the console)?

I tried typing:

git rebase -i HEAD~200

but I don’t know how many commits go through. I tried counting commits in Git Extensions, but it's hard to see, as it shows a mixture of everything that comes from branch branches and a chest. The menu "Show current branch" does not help.

+4
source share
2

, master, :

git rebase -i `git merge-base HEAD master`

git merge-base (.. , ).

git rebase master ( , ), .

: , , , .

2: , , .

+6

, :

myBranch , :

...M---A---B---...---N---...---X  myBranch

A X, commit A ( commit M ),

git checkout myBranch
git reset --soft <commit id for M>
git commit -m 'squash commit from A to X'

myBranch ( squash commit S):

...M---S  myBranch
+1

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


All Articles