Eslam Zedan
3 Mar 2022
General
Somebody pushed a branch called release
with git push
our repository.
Now I'm trying to check out to release
branch.
I've tried:
git checkout release
which does nothing
git checkout origin/release
gives * (no branch)
.
How do I check out a remote Git branch?
You can fix the issue by the below command.
git fetch origin 'your_remote_branch':'your_local_branch_name'
This will fetch your remote branch
It will also create a new local branch by name “your_local_branch_name” (if it is not existing)
Here you can track the remote one in it.
– – – –
To checkout local code, you can use below commands,
git fetch
git checkout -b your_local_branch_name origin/actual_branch_name
It will work for you.
© 2024 Copyrights reserved for web-brackets.com