3

I am git newbie. Learning while doing things. I have this setup. Now lets say I am on branch1 folder (git bash), like c:\branch1\ and do a checkout master. It switches to master branch, but does not change the folder. So the folder I am in is not the master's folder, which is lets say c:\master\. Its branch1s folder.

Do I need to switch to master's folder to do any work on master branch files? Or just checkout is enough.

May be its a dumb question. :-) But I am trying to understand this. So want to get it clear.

Zoe
  • 23,712
  • 16
  • 99
  • 132
Kevin Rave
  • 11,992
  • 31
  • 97
  • 158

1 Answers1

1

As has already been noted, branches have nothing to do with folders. A branch with git is one of a few ways to say "a version of the code"

For example when you

git checkout master

you are telling git

show me the master version of the code

likewise

git checkout branch1

is telling

show me the branch1 version of the code

When you git checkout it will dump the appropriate files and folders into your working directory, that is the folder containing the .git folder. The .git folder might be hidden depending on your system, but be aware of it.

Steven Penny
  • 82,115
  • 47
  • 308
  • 348