Jack23
Jack23

Reputation: 1396

Push git branch

Hi guys I have a question.

At the moment I have this Branchs f.e. :

DEV*
BRANCH1
BRANCH2

DEV is the main branch. Now I need to create another branch and so I create a branch3

DEV
BRANCH1
BRANCH2
BRANCH3*

I work on this branch and then I want to push on git. (I don't finish to work in this branch but I want to save what I have done) Can I push even if I'm in Branch3? Or I should turn in the DEV branch make a "merge" and then push?

Thank you, I'm new in this world .

Upvotes: 1

Views: 63

Answers (1)

Marlon Abeykoon
Marlon Abeykoon

Reputation: 12465

If you create the branch from DEV branch, then the head of DEV and BRANCH3 is at the same commit. so you can just push the new branch as follows.

git push -u origin BRANCH3

If you have committed anything to BRANCH3 after creating it then that change will be pushed, but if you have committed anything to DEV after creating the branch that change will not be pushed unless you merge DEV to BRANCH3

Upvotes: 2

Related Questions