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 maybe bigger problems that you've run into.
0:08 And the first one I want to talk about is oh no, I've lost the .git folder.
0:12 Let's see what I mean. Let's just take our rock paper scissors project that we've been working on over here. We've got our RPS folder.
0:20 And if you were to just come over here and say copy, go somewhere and then paste those details,
0:26 you will have all the contents of the github repository as they are right now for
0:32 whatever branch you've checked them out and whatever state you've gotten it into.
0:36 But remember if you hit command shift dot on Mac Os or Windows and explorers to
0:42 say show hidden files there are these other files that would not be copied and not moved around. So somehow you've lost access to these things.
0:51 But you've made changes. Well what you could do is you could just go and check this out this project out again to another folder,
1:00 copy everything. Overwrite it and it will automatically pick up all the changes. At least all the new files and modified files,
1:08 I guess it wouldn't pick up the deleted files, you'd have to synchronize that a bit.
1:12 But if something gets completely messed up then you can overwrite those files and keep going
1:17 This also works. If you get the git hub repository into an absolute trashed state. You're like, I just even with Git commands,
1:25 I cannot get it back into a state that works. It's so messed up. But I've made these changes. I need to keep well check out another folder,
1:34 copy. Just the actual files, not the .git folder, stuff like that. Drop it over, open it up again and you'll have just the changes that you've
1:43 made. Not like all the git history. You gotta be really careful there. I mean the commits you haven't pushed will get lost that way and so on.
1:50 But it is sort of an escape patch if things get too out of control. But if you lose the git folder,
1:56 you basically turn this structure that contains the files. You can still, you know,
2:01 check it out again and override it and it will take on whatever changes that maybe we're still in those files that got separated from git.


Talk Python's Mastodon Michael Kennedy's Mastodon