I need to work with a remote repository and I have it set to a local branch but I need to type the URL every time I want to update the branch from the remote repo. Is there a way to change the origin only for that one branch? So to update the branch I don't have to use the URL.
What I currently do:
git fetch https://github.com/username/repo branch:my-local-branch
But I'd rather just do something like:
git fetch my-local-branch
Where the above would fetch from https://github.com/username/repo.
origin is just an arbitrary name that happens to be the conventional default. But you can add as many remote repositories as you like. Just use git remote add username https://github.com/username/repo, then you can configure the upstream of your local branch with git branch --set-upstream-to=username/branch my-local-branch.
From then on you can use git pull or git pull --rebase from your my-local-branch or git fetch username/branch to fetch the remote branch from that repository.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With