I’m a Git noob but I use it extensively. The version control lets me keep track of my code changes and points to where I should fix. But when I tried to do
git pull origin master, it always showed me this in the terminal:
And every time I pushed to the
master branch, it always made a new separate branch. And I didn’t get it. Why the heck would it create another branch from the default branch?
Then, I realized this:
The default branch is named
master. This means, when you make a new repository and want to push to the central branch, you should push to
main branch, unless you rename the default branch’s name.
I think a lot of outdated articles still tell you to do something like
git pull origin master. So, if you like to execute that command, you can rename your default branch:
Click on the branch drop-down menu and go to
View all branches.
Then, you see the pencil icon. Click on it.
master and hit
Rename branch. Then, you’re all set! Now you can do
git pull origin master to keep your local repository up-to-date, and you won’t see
fatal: couldn't find remote ref master in the terminal.
Thanks for reading, and I’ll come back with another post!