git init
#
When you have a directory with code in it, or perhaps you're starting from nothing, you can make that directory a valid Git repository. Remember that a Git repository is simply any directory with a .git
directory inside of it.
Let's try this now on an empty directory:
1 2 3 4 5 6 7 8 9 10 11 12 13 |
|
One moment we had an empty directory, and after a simple git init .
, we have a .git
directory. Now we can add files to this directory. Let's add a text file:
1 2 3 4 |
|
I just used nano
to edit a new file and put Hello, world!
inside of it. You can write whatever you like inside of the file, however.
How does Git now see this file? That's where the git status
command comes in, which we'll look at next.