3

I have a propject that have a master branch.

enter image description here

T create a new branch with this command.

$   git branch develop
$   git checkout develop

when I look the gitlab(local), develop branch is not added to my project/branch.

after the switch to develop branch and I made many changed to the develop branch.

I need to commit and push the develop branch to gitlab(local).

I know that if I create new branch from gitlab(local) then I can clone and commit and ...

but I need to to push the created branch from repo to gitlab(local) with command line.

How to fix this?

Thanks.

AminRostami
  • 2,585
  • 3
  • 29
  • 45
  • If I understand correctly, you want to push develop branch into origin? `git push origin develop`... perhaps even use `--set-upstream` so that the local branch starts tracking the remote one, – eftshift0 Dec 04 '19 at 04:17
  • @stud3nt , my problem with displayed it on git(local). I no problem with `create` branch. – AminRostami Dec 04 '19 at 06:34
  • @phd, I saw that question before, and no problem with `create branch`, my problem with displayed it on git(local). I mentioned in prev comment. – AminRostami Dec 04 '19 at 11:30
  • The linked answer shows both creation and pushing and pushing is your answer. – phd Dec 04 '19 at 11:31

2 Answers2

1

Check what git branch -avv tells you about your current branches.

The develop branch should be associated with an origin/develop, which means the dropbox (where you see "master" in your screenshot) should now include "develop".

But no new commits were pushed, since you have created develop where master is, which is why the last "update" is still the one done on master.

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
0

I found my problem.

I realized that as long as I didn't commit and push from the new branch (develop), It does't appear in git server.

this resolved with commit and push the develop branch.

I did this:

git commit -m "..."
git push -u origin develop

then develop branch appear in git server.

I hope is useful.

AminRostami
  • 2,585
  • 3
  • 29
  • 45