How do I fetch only one branch of a remote Git repository?


I'd like to grab a single branch (not all of them) of a remote repository and create a local tracking branch that can track further updates to that remote branch. The other branches in the remote repository are very big, so I'd like to avoid fetching them. How do I do this?


git fetch <remote_name> <branch_name>

Worked for me.

Git 'error: The branch 'x' is not fully merged'

How to get the changes on a branch in Git