Question

Master Branch had commits like this : A -> B -> C(HEAD) . HEAD was at C.

What I did :

I checked out B and made commits on top of it.

Now the tree looks like this :

    A -> B -> C(master)(origin/master)
         |
         | -> B1 -> B2(HEAD)

git status on the project directory is giving me the following message :

# Not currently on any branch.
nothing to commit (working directory clean)`

So it means that B1 and B2 cannot be pushed. I got to know that this is happening because these commits doesn't exist on any branch. Now, if I switch my branch back to master will these commits be lost? I am expecting a few more commits(B3, B4 ... BN) on these unnamed branch after which I want C to come on top of it. In essence, I would like to see the master branch in this way :

    A -> B -> B1 -> B2 -> B3 -------> BN -> C(master)(origin/master)

or atleast this way :

    A -> B ---------------------> C(master)(origin/master) -> D
         |                                                    ^
         |                                                    |
         | -> B1 -> B2 -> -> ...->BN--------------------------

What options I have to accomplish this? I want to be able to save the commits in the origin.

Any suggestions/directions is appreciated.

No correct solution

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top