Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is a back-merge

Tags:

I’ve watched some videos on the git-flow scripts and one term that comes up is “back merge” - e.g. hotfix is merged into master and back merged into develop.

I’m assuming back merge is a concept and not a native git command. What exact commands comprise a back merge operation?

like image 877
mlhDev Avatar asked Nov 29 '17 14:11

mlhDev


People also ask

What does back merge mean?

The use of the term "back merge" is usually somewhat arbitrary. It just means to do a merge, like any other, but in a direction that is "backwards" compared to the normal flow of the branching conventions.

How do I get back merge?

In case you are using the Tower Git client, undoing a merge is really simple: just press CMD+Z afterwards and Tower will undo the merge for you!

Is it better to rebase or merge?

But, instead of using a merge commit, rebasing re-writes the project history by creating brand new commits for each commit in the original branch. The major benefit of rebasing is that you get a much cleaner project history. First, it eliminates the unnecessary merge commits required by git merge .

What is a forward merge?

Related Content. A merger in which the target company merges with and into the buyer, the buyer assumes all of the target company's assets, rights, and liabilities, and the target company ceases to exist as a separate entity.


2 Answers

The use of the term "back merge" is usually somewhat arbitrary.

It just means to do a merge, like any other, but in a direction that is "backwards" compared to the normal flow of the branching conventions. If you visualize branches arranged like

master    hotfix    release    dev    feature   |          |         |        |         |   |          |         |        |         |   |          |         |        |         |   |          |         |        |         | 

then changes normally "flow" from right to left - feature to dev to release to master. But while hotfixes are pretty far left - they get created from master - they still have to be merged "to the right" into dev, so some people describe that as merging backwards, or back-merging.

In my opinion, that's not the most compelling use of the term, because it can be read to imply that the opposite merge (from dev to a hotfix branch) were a "forward merge" - but in fact that's something that shouldn't be done. In this case the direction being "backward" is more about the general flow of changes if you visualize the branches in a particular way as above.

A more compelling use of the term is when you have a long-lived feature branch (which itself is something of an anti-pattern in agile processes that are likely to use gitflow; but sometimes you may need one). In that case you periodically should update your long-lived feature from dev, so that the two don't deviate too much leading to a disaster of a merge conflict later. (And this opens up a whole can of worms about "unnecessary" merges, what makes a good history, and git rerere... but I digress.) That can clearly be called a back-merge because the opposite - merging your feature in to dev - is a normal, textbook use of merge in the branch model.

like image 170
Mark Adelsberger Avatar answered Oct 11 '22 19:10

Mark Adelsberger


Backmerge is nothing but add your hotfix changes into your current working branch.

Let's say you have two branches Develop and Master
You found any major bug on Master. You fixed it on Master branch itself as a hotfix. Later you need to add your bugfix change into your current working branch i.e Develop branch. so you need to do back-merge like this


  1. git checkout Develop
  2. git merge Master
  3. git push origin Develop
like image 23
Vrushali Raut Avatar answered Oct 11 '22 19:10

Vrushali Raut