How to fetch remote branch properly?

Viewed 106

I had to delete my git branch and now need to fetch that remote branch.

I did the following steps as I've seen someone's post here.

git clone <repository-address>
git fetch origin
git checkout -b <branch> origin/branch

But I am not sure if it worked as expected. Here's my output for git branch -a

* my-branch (GREEN)
  master (GREEN)
  remotes/origin/HEAD -> origin/master (RED)
  remotes/origin/my-branch (RED)

If anyone help me understand whether my-branch will be matched with the remote one or not. If not, I'd appreciate it if you could explain this. Thanks!

1 Answers

If anyone help me understand whether my-branch will be matched with the remote one or not

Probably. But it's impossible to be certain from the info you have given. To find out, say

git branch --all -vv

If the listing for my-branch also mentions origin/my-branch, you're all set. If it doesn't, just set the upstream yourself.

Related