2

I am new to gitlab. I have successfully created unprotected branches dev & design with master role in project testapp with the following commands:

git checkout -b dev 
git checkout -b design

Then I push all the files successfully to both branches.

Later on I run the following command to make my branches remotely :

git branch dev 
git branch design

Now the issue is, my team member whom I have added in project with developer role is not able to list out branches dev & design and also not able to push to those branches. He try to push with following commands:

git add .
git commit
git push -u origin dev 

Please list the steps for me. Thanks

Sensei James
  • 2,617
  • 30
  • 36
Payal
  • 369
  • 4
  • 7
  • Those last 3 commands should be executed by `you`. These add the branches to the remote tracker. Without that, they'll never see the branch and cant push to it. You can also do `git push --all -u` to push all of your local branches to the remote repository. – Ohgodwhy Oct 07 '16 at 16:00

1 Answers1

0

Sounds like your teammate needs to run the checkout command to track the remote branches. Whether or not he has local dev/design branches, he just needs to associate them with their corresponding remote branches. This is done by creating a tracking branch:

Tracking branches are local branches that have a direct relationship to a remote branch.

To create new tracking branches locally, you can use the shorthand:

git checkout dev
git checkout design

Where the general form is:

git checkout -b [branch] [remotename]/[branch]

E.g.

git checkout --track origin/dev
git checkout --track origin/design

Or, if you'd would rather turn an existing local branch into a tracking branch, check out this post.

Community
  • 1
  • 1
Sensei James
  • 2,617
  • 30
  • 36