-2

I have created one branch 'feature' from default master branch, So Whatever files present on master it comes to my 'feature' branch. I switched to 'feature' branch and added 2 more files into this branch and committed this change. So When I switch to master I have 2 files and when I switch to 'feature' branch I have 4 files 2 old + 2 newly added. I can able to see the files in my working directory.

So, How Git manages the switching the branch and only showing the files present on particular branch. Does it creates a folder? anywhere?

I want to know how git manages the branches internally.

  • 1
    https://stackoverflow.com/questions/53586979/how-are-different-branches-stored-locally-from-git-on-my-disk – CodeCaster Aug 07 '23 at 12:56
  • 1
    https://stackoverflow.com/questions/33555221/where-are-files-for-local-branches-stored – CodeCaster Aug 07 '23 at 12:56
  • Sounds like you are talking about _uncommitted_ things. – eftshift0 Aug 07 '23 at 12:57
  • In Git, branches are labels. Specifically text files with the ID of the commit is points to. Definitely give https://www.youtube.com/watch?v=1ffBJ4sVUb4 a watch – evolutionxbox Aug 07 '23 at 13:00
  • They're stored in the hidden .git folder. It's more than just a folder, it's a kind of database of all the changes you've made - the log of your project's history. A branch therefore is just a fork in the log. – slebetman Aug 07 '23 at 13:40
  • No idea what Git is, what a branch is, what switching does? Please read https://www.biteinteractive.com/picturing-git-conceptions-and-misconceptions/ – matt Aug 07 '23 at 14:25

0 Answers0