Creating a repository is very simple, first of all, choosing a suitable place to create an empty directory:
$ mkdir learngit$ cd learngit$ pwd/Users/michael/learngit
Initialize a git repository, using git init
commands.
Use the git init
command to turn this directory into a repository that git can manage.
$ git initInitialized empty Git repository in /Users/michael/learngit/.git/
If you don't see the .git
directory, it's because the directory is hidden by default and ls -ah
can be seen with commands.
Add Files multiple times:
$ git add file1.txt$ git add file2.txt file3.txt$ git commit -m "add 3 files."
Summary:
Initialize a git repository, using git init
commands.
Add files to the Git repository in two steps:
The first step, use the command git add <file>
, note, can be used repeatedly, add multiple files;
The second step, using git commit
the command, is done.
To keep track of the status of your workspace, use the git status
command.
If git status
you are told that a file has been modified, you git diff
can view the modified content.
Creating Git and its initialization