Git merge squash repeatedly

Starting with

      X stable
     /                   
a---b---c---d---e---f---g development

You can use the following steps to copy the last commit from your development branch to your stable branch:

git checkout development@{0}  # get working tree from "development", detach HEAD
git reset --soft stable  # reposition detached HEAD on "stable"
git commit  # enter the appropriate commit message
git branch temp  # create a temporary branch "temp" at HEAD
git checkout temp  # get on the new temporary branch
git branch -M stable  # rename "temp" to "stable"

so you end up with:

      X-------------------G stable
     /                   
a---b---c---d---e---f---g development

If you continue work on “development”, e.g.,

      X-------------------G stable
     /                   
a---b---c---d---e---f---g---h---i---j development

you can repeat the same git commands as above and you will end up with:

      X-------------------G-----------J stable
     /                   
a---b---c---d---e---f---g---h---i---j development

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)