I Git By

I was recently updating some of my Personal/Public Unity Libraries. I use SourceTree for most of my GIT work. One, because I am old, and don't like using the command line much anymore, and two because they have a really slick interface for using the GitFlow methodology, which I "try" to follow.

So, I tried to initialize the GitFlow for the project folder, but alas, I was missing my MASTER branch. I had removed it after pushing my DEVELOP branch to GitLab.

To fix the issue, all I needed to do was bring down the MASTER branch. Of course, I Googled, and there were about one thousand answers. I got answers on how to add new branches, how to merge branches, and then it dawned on me that I was asking the wrong question.

What I wanted to do was simply PULL the MASTER branch from my REMOTE without checking it out. Turns out, there is an easy way to do this.

First check your current branch status;

git branch -a

the result was telling me that my MASTER branch was available remotely.

* develop
remotes/origin/develop
remotes/origin/master

Great, but how do we get it without disrupting the current DEVELOPMENT branch? Simple;

git pull origin master:master

this updated my local master, and showing the branches again gave me this result;

develop
* master
remotes/origin/develop
remotes/origin/master

I was very glad to find this, I certainly wasted a good hour or so searching around the internet's looking for the answer. Maybe someday Google will be able to interpret my thoughts, but until then, I still need to carefully word my questions if I want to get the correct answer.

Comments

Comments powered by Disqus