Up and Running with Git Transcripts
Chapter: Our first git repository
Lecture: Local-only repositories
Login or
purchase this course
to watch this video and the rest of the course contents.
0:00
What if you don't want to host your code on Git hub or git lab or something like that.
0:05
You just want to have the features of Git but locally and you're happy to just have that local file or that local project structure.
0:12
That local repo for you there to work with your luck. All you have to do is type git init in a terminal or command prompt
0:21
and you're good to go. Let's see in source tree. We could do new and create a local repository.
0:28
Put it in some location. Notice it will let us create a remote repository but not by default. Or if you want to run the terminal,
0:38
you could come over here to desktop. We'll talk more about the terminal and some of these widgets that you see here on
0:44
the prompt in a minute. But I can make a directory called local only. Go to local only and say git init and check it out.
0:54
We have a local Git repository. My prompt actually shows me we're in a repository with the name Master and actually people
1:03
are moving to not use Master anymore but instead to use main as you saw when we checked out our other project. So I'm gonna go ahead and run that one.
1:12
So I don't see that warning all the time. And two just because that's sort of a common standard these days.
1:19
Alright. That didn't change this repository by the way. That's for the future. But if you want just a local repository.
1:25
Let's add a file.py And let's add this into visual studio down here. I'm gonna go wrap.py and say hello world.
1:36
Well as a comment perhaps or let's go crazy. You want to print it right? A whole application here. Here we go. Notice it has all the git features.
1:47
If I want to git it, I can stage this and say ready to release our new app. Check here we go. And if we go and put this back,
1:58
we have all the features. You can see the history, we've already editor code. So if you want just a local version,
2:05
git init or even just a new empty repository that's disconnected. But there's no way to back it up or share it.
2:12
You can attach it to something and some hosted location like github. But if you're gonna do that anyway,
2:19
you should start there, as we did at the beginning of this chapter.