dissidia
dissidia

Reputation: 1581

Did I create additional branch?

I am cloning this particular repo in which it initially already has a Pull Request done by one of my colleague but I was not made aware of it..

Basically, this is what I did:

It was only at my PR page (I am using Atlassian), then I realized that my colleague has actually opened up another PR, which is still open but his branch naming is different from mine..

This is evidenced by the top part of the PR page which shows the name of branch and which to be merged..

My questions here is: 1. am I creating an additional branch? If so, will this cause any issues if they were merged into the develop?

  1. If I am trying to make my branch name to be the same as my colleague's branch, is this the command I should have typed instead: git checkout -b feature/Issue01 remotes/origin/feature/Issue01

Upvotes: 1

Views: 56

Answers (1)

mkasberg
mkasberg

Reputation: 17262

git checkout -b is used to create a new local branch. You're not using it quite right.

The easiest way to do what I think you're trying to do is git checkout feature/Issue01. If that branch doesn't exist locally (it shouldn't), git will detect that it does exist upstream, and it will pull it and set up tracking info for you.

On any branch, you can use git branch -u origin/feature/Issue01 to have the local brancy that you're currently on track whatever upstream branch you specify.


Alternatively, something like this would work: $ git checkout -b feature/Issue01 --track origin/feature/Issue01

Upvotes: 2

Related Questions