Git Tutorial
Creating a Project for Git
Let's learn how to create a git repository from scratch.
Step1:Create a “Hello, World!” page
Get started in an empty working directory (for example, work, if you downloaded the file from the previous step) and create an empty directory named “hello”, then create a hello.html
file in it with the following contents.
RUN:
mkdir hello
cd hello
touch hello.html
FILE: hello.html
<h1>Hello, World!</h1>
Step2:Create a repository
So you have a directory that contains one file. Run git init
in order to create a git repo from that directory.
RUN:
git init
RESULT:
$ git init
Initialized empty Git repository in /Users/kwikl3arn/Documents/Presentations/gitdemo/auto/hello/.git/
Step3:Add the page to the repository
Now let’s add the “Hello, World” page to the repository.
RUN:
git add hello.html
git commit -m "First Commit"
You will see …
RESULT:
$ git add hello.html
$ git commit -m "First Commit"
[master (root-commit) 911e8c9] First Commit
1 files changed, 1 insertions(+), 0 deletions(-)
create mode 100644 hello.html