Doubts about branch structure and repositories

3

I'm starting to study and use DVCS (versioning programs: GIT, mercurial).

I tried to reassemble a folder structure, using branches but the result was not as expected. I wanted to understand how the structure works.

What I did was as follows:

I opened a rep on gitbucket:

xyp

I have the branch master, and I created 5 branches: b1, b2, 3b, b4 and b5

I downloaded to my machine in a folder, I made a clone , I pasted a folder [b1] inside that folder, I accessed the branch with the same branch:

git checkout -b b1

Then:

git add *

To add the new files in that branch, and then commit:

git commit -m "1 commit b1"

After pushing:

git push https://*******@bitbucket.org/*****/******.git

And I was doing so in the 5 cases imagining that I would have the following structure in the branches as the folders:

             masters
b1  b2 b3  b4

But when I looked at the branches on gitbucket, the structure was all crooked:

  • 1 commit b1 has 5 branches inside [b1 b2 b3 b4 b5]
  • o 2 commit b2 has 4 branches inside [b2 b3 b4 b5]
  • 3 commit b3 left with 3 branches inside [b3 b4 b5]

And so on. And the last one was with one, only with himself

commit b5 (b5)

Why did this strange structure not agree with what I thought and struc- tured?

    
asked by anonymous 29.06.2018 / 18:58

1 answer

0
  

And I was doing so in the 5 cases imagining that I would have the following structure in the branches as the folders:

Here's the problem: what did you do after this.

You've probably done the following:

mkdir b1
git checkout -b b1
git add *
git commit -m "1 commit b1"
git push

After this, instead of going back to the master branch and creating the next branch from it, you continued:

mkdir b2
git checkout -b b2

E etc, creating a structure like this, with a branch created from the last branch:

                                  .---05
                                 /
                            .---04
                           /
                      .---03
                     /
                .---02
               /
         .---01
        /
  00<--´

And not as you like:

               .---05
              /
             .---04
            /
           .---03
          /
         .---02
        /
  00<--´---01

That would be done by creating all branches from the master branch. Therefore, between the push and mkdir , a:

git checkout master
    
16.08.2018 / 18:02