GitHub Combine many commits into one

I searched a lot, but did not find a similar question.

Let's say that I have two branches. Branch S (stable) and branch E (experimental). The pilot was created "from the Stable Branch."

I work all the time on the E-branch, doing

git add -A . git commit -m "my new commit" git push origin E 

And everything works fine. When I think this time is for me, I just do:

 git checkout S git merge E git push origin S 

And it works well, but my stable spam branch is with every commit from the experimental branch. I donโ€™t want to โ€œsquashโ€ all the commits into one in the experimental branch, but I want to have only one commit during such a merge, and not all single ones.

Perhaps there is a very simple command for this, but I did not find it. Unfortunately, git rebase E does not do the trick; all the commits are still displayed as single.

Thank you for your time.

+4
source share
1 answer

Try git merge --squash E instead of git merge E

+2
source

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


All Articles