Home > Enterprise >  Small commits in one branch as one commit to another
Small commits in one branch as one commit to another

Time:05-25

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)

CodePudding user response:

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
  •  Tags:  
  • git
  • Related