GithubDesktop - Switching branches where do my files go?

So with the desktop, I’ve cloned a repo onto my local drive. There is the master branch and a working branch. As its all new the master branch has a readme only, the working branch has a couple of files (plus a .gitignore)

The local and remote repos are the same except for one file in the local which has an edit. This has been committed to the local repo in the working branch, but not pushed to the remote or the local copy of the master branch.

In the desktop GUI I can switch between branches, when I do in windows explorer I can see the files appear and disappear.

My question is, where do my files go to/come from? Presumably the desktop has cached them somewhere? I know they aren’t being fetched from the remote repo as when I switch to the working branch, I get the file with the edit.

I was presuming (before I started to use GH) that the separate branches would be visible in the windows folder I’ve cloned the repo to.

Thanks, as you can tell, total newbie (but already discovered a bug switching branches)

Tim

Hi Tim, this is one of them things that’s actually a feature and not a bug :wink:. If you think of a branch as a workspace, each time you switch workspace, you get the files related to the current workspace. The same thing happens with git, as you switch branches, you switch your ‘workspace’ and that is why the files appear and disappear. This is totally normal.

If you are interested in how to apply these changes to a new branch, you can have a look at the git merge command. Hope this helps.

Thanks, understand that.

Its perhaps a point of curiosity. Clearly the files are still present somewhere, and the app just moves them into and out of the workspace. I just want to know where they are being cached :slight_smile:

BTW, the bug is a bit different, I think Ive worked out the issue ie how to reporduce it, I’ll put a separate post up just in case I’ve misunderstood something, before raising an actual bug report,

Tim

Ah okay, sorry for misunderstanding the mention of a bug :smiley:, the files are indeed still stored locally within the /.git folder, though I don’t believe they are stored as files, but rather a history of changes to the current branch. More about this can be found by reading the Git Objects documentation.

Thanks, so whats stored is basically a set of diffs (which would be why it doesnt work so well for binaries)? I’ll have a look at the link.

Looked at the link :slight_smile:

So files are effectively stored in a private file system in the objects folder…