[Novalug] Switching Branches in GIT
James Ewing Cottrell III
jecottrell3@comcast.net
Wed Sep 20 19:05:57 EDT 2017
Well, for starters, it changes the Working Directory!
Here's what I was trying to do, and after my experience, I can't say
that it was truly advised!
Like many people, I did a git init and intended to track changed
content, but only for "interesting" files. Then I got the "bright" idea
that I might want to create a branch (named after the hostname) for the
whole thing so that I could push it to a master repo, make changes
there, and pull them back.
OK, so how do I get back to the master branch? As it turns out, anything
I didn't add will be deleted, and indeed, it was!
The manpage for git checkout doesn't really say this, altho O'Reilly's
new book does. Turns out that I bricked the machine.
One possibility would be to use two git repos, using the GITDIR
environment variable to keep the branches distinct, but that would
prevent sharing.
Yeah, don't try this at home, kids!
JIM
P.S. if it's not clear, I can provide some git commands to illustrate
what I did.
On 9/20/2017 6:06 PM, Scott Talbert wrote:
> On Wed, 20 Sep 2017, James Ewing Cottrell III via Novalug wrote:
>
>> Is there any way to switch branches besides using git checkout?
>
> That's how to do it. What's wrong with git checkout?
>
---
This email has been checked for viruses by Avast antivirus software.
https://www.avast.com/antivirus
More information about the Novalug
mailing list