Up and Running with Git Transcripts
Chapter: Tips and fixing mistakes
Lecture: Fixe: Lost .git folder?

Login or purchase this course to watch this video and the rest of the course contents.
0:00 Let's close out the course. Talking about a few ways to solve minor problems or
0:04 maybe bigger problems that you've run into.
0:07 And the first one I want to talk about is oh no,
0:10 I've lost the .git folder.
0:11 Let's see what I mean. Let's just take our rock paper scissors project that we've
0:16 been working on over here. We've got our RPS folder.
0:19 And if you were to just come over here and say copy,
0:23 go somewhere and then paste those details,
0:25 you will have all the contents of the github repository as they are right now for
0:31 whatever branch you've checked them out and whatever state you've gotten it into.
0:35 But remember if you hit command shift dot on Mac Os or Windows and explorers to
0:41 say show hidden files there are these other files that would not be copied and not
0:46 moved around. So somehow you've lost access to these things.
0:50 But you've made changes. Well what you could do is you could just go and
0:54 check this out this project out again to another folder,
0:59 copy everything. Overwrite it and it will automatically pick up all the changes.
1:04 At least all the new files and modified files,
1:07 I guess it wouldn't pick up the deleted files,
1:09 you'd have to synchronize that a bit.
1:11 But if something gets completely messed up then you can overwrite those files and keep going
1:16 This also works. If you get the git hub repository into an absolute trashed
1:21 state. You're like, I just even with Git commands,
1:24 I cannot get it back into a state that works.
1:27 It's so messed up. But I've made these changes.
1:30 I need to keep well check out another folder,
1:33 copy. Just the actual files,
1:35 not the .git folder, stuff like that.
1:37 Drop it over, open it up again and you'll have just the changes that you've
1:42 made. Not like all the git history.
1:44 You gotta be really careful there.
1:46 I mean the commits you haven't pushed will get lost that way and so on.
1:49 But it is sort of an escape patch if things get too out of control.
1:53 But if you lose the git folder,
1:55 you basically turn this structure that contains the files.
1:58 You can still, you know,
2:00 check it out again and override it and it will take on whatever changes that maybe
2:05 we're still in those files that got separated from git.