git: How to fetch a remote branch

Yet Another Guide because existing ones don't work with shallow clones.

To fetch a specific remote branch and associate it with a local branch, use git fetch REMOTE_NAME REMOTE_BRANCH:LOCAL_BRANCH.

This should work with all repos, including shallow repos.


#git #tutorial


You can follow this blog via its RSS feed or by searching for @[email protected] on your Mastodon/ActivityPub instance.