Dennis Ngu
Dennis Ngu

Reputation: 37

Remote branch not show in terminal?

My task is to commit somethings to other remote branch(not master) in gitlab. I have created another active remote branch name as Dennis (where the remote branch I want to commit to it) on the gitlab repository's branches part. However, it does not show the remotes/origin/Dennis branch in the terminal. How I have remotes/origin/Dennis inside the git branch -a status? Otherwise, I can't commit file to remotes/origin/Dennis.

The git branch-a status is shown in my macbook terminal:

macbook$ git branch -a
* Dennis
  master
  remotes/origin/HEAD -> origin/master
  remotes/origin/master

Upvotes: 1

Views: 2278

Answers (2)

Soumya Kumar
Soumya Kumar

Reputation: 47

git fetch --prune

In addition to @VonC's answer I also like to add --prune flag to the fetch command so that it can remove the remote branches that have been deleted from the list.

Upvotes: 0

VonC
VonC

Reputation: 1323125

A simple git fetch (no need for --all) should be enough.

Check the output of git config --local -l (done inside your repository).
If you see the refspec:

remote.origin.fetch=+refs/heads/*:refs/remotes/origin/*

That means a fetch will fetch all remote branches.

Upvotes: 2

Related Questions