-1

I have created git branch locally in android studio and I have zipped file and when I have unzipped that project to other folder and opened I am not able to see my previous local branch and commits what I have to do see my previous branch and commit created a local branch in android studio

and opened archived file from other directory

Edgar
  • 860
  • 1
  • 17
  • 38
  • Did you download that zip from github, or where did you get your zip file from? Does your directory contain a `.git` dir? – lucidbrot Nov 29 '19 at 19:27
  • @lucidbrot I get from google drive – Edgar Nov 29 '19 at 19:29
  • @lucitbrot I dont have .git dir on my directory what is your suggestion – Edgar Nov 29 '19 at 19:30
  • @lucidbrot please check my update post and screenshot – Edgar Nov 29 '19 at 19:35
  • When you have a git repo locally (which you have, because you could create a branch), it stores its data in a `.git` folder. That may be invisible on some operating systems, but it should be there. When you zip only the file, and not this folder, git will not have any information when you unzip it again. Did you zip only the file? – lucidbrot Nov 29 '19 at 19:42
  • If my answer helped you, please give it the "accept" checkmark and/or upvote it :) – lucidbrot Nov 30 '19 at 12:44

1 Answers1

0

What you need to do is zip the whole repository instead of just the file.

That is because git stores all its information in a .git directory in the root of your repository directory. That .git directory may be hidden in some explorers / on some operating systems, but it is there nonetheless.

When you zip the whole repository, with all files, there's a disadvantage though:

  • It will be a large zip archive, because the complete history of all files is in it
  • You will be sharing all of your files if you're giving the zip to somebody else

So perhaps you'd rather like to extract one file and its complete history. That is a bit harder to grasp though.

lucidbrot
  • 5,378
  • 3
  • 39
  • 68