Small commits in one branch as one commit to another

I have a question about refurbishing workflow.

Suppose I have two branches, master and devel.
Suppose also, that master is clean, for scope of the question, lets imagine it has only initial commit "Initial commit".

devel, however, is quite messy and has a lot of small commits.

I want those small changes in devel branch to be added to master branch as one single commit, lets say "Single commit"

In the end master must have all the changes made in devel and the history must be two commits long ("Initial commit" and "Single commit", to be precise)

>Solution :

You ought to create a third branch, with multiple commits from the devel branch. Then, you merge the third branch into the master branch, and there you have it: two commits into the master branch.
Here is the example

  1. Master branch
  2. Devel branch
  3. Temp branch
git checkout devel

git checkout -b temp

git commit 'Single Commit'

git push

git checkout master

git merge temp

Leave a Reply