I'm learning Git and experimenting. I understand how to do basic operations but am struggling with creating a new branch. I'm using the command prompt in windows and the github tool in a browser. I have attempted to simulate the creation of a new branch by making a new branch (named branch_1) in the browser, but when I try to find that branch in the command prompt, it does not show up. For example, here's what I get in the command prompt:
git branch
_notes/dwsync.xml
master
v1.1
v1.2
v1.3
How do I get the new branch to appear?
When you create a branch in github, it's in the github remote. You need to fetch the branch from that remote, to your local, and tell your local to track that branch.
git fetch <remote_name> <branch_name>
git checkout --track <remote_name>/<branch_name>
This assumes you want the branch_name on the remote to be the same on your local.
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