0

I'm trying Git Workflow before adoption. After a whole release cycle I have ended with this branch tree. (c: commit, m: merge)

master      v0 - - - - - - - - - - m1 
                                   |
release                  - c3 - c5 - 
                        |           |
development v0 - c1 - c2 - c4 - - - - m2 - c6

After version 0 development continue to c1 and c2.

After c2 a release branch was created.

git checkout -b release development

development branch evolved to c4 while release branch evolved to c3 and c5.

After c5 I merged release into master

git checkout master
git merge --no-ff release

and into development

git checkout development
git merge --no-ff release

then release branch was deleted

git branch -d release

Only master and development branches exist now. I thought that c3 and c4 commits in old release branch will be removed from history and I would end up with linear master and development branches. c3 and c4 are included in m0 and m1 commits so there is no need to keep then.

Now in Bitbucket if I inspect only master branch I get this tree:

master      v0 - - - - - - - - - m1 
                 |               |
                 |    - c3 - c5 - 
                 |   | 
                c1 - c2

While I expected just:

master v0 --- m1

And this is the one for development:

                     - c3 - c5 - 
                    |           |
development v0 - c1 - c2 - c4 - m2 - c6

While I expected:

development v0 - c1 - c2 - c4 - m2 - c6

Is there any way to avoid this?

Can this situation be fixed now?

max630
  • 8,762
  • 3
  • 30
  • 55
David Casillas
  • 1,801
  • 1
  • 29
  • 57
  • When you merge, you can squash all of the commits into a single commit instead of preserving commit history. I don't recommend doing that on a regular basis, though. – Ian MacDonald Feb 09 '18 at 17:26
  • Background reading: https://stackoverflow.com/q/25068543/1256452 – torek Feb 09 '18 at 17:52
  • 2
    Use `git log --first-parent master` to view your branches, if you remove the history from git, things become hard to figure out where something got changed when there is a problem – Ferrybig Feb 10 '18 at 11:51
  • Really nice option. It really helps to show main branches log uncluttered with extra commits. – David Casillas Mar 26 '18 at 10:25

0 Answers0