lab 3 Create a Project

Goals

Create a “Hello, World” program 01

Starting in the empty working directory, create an empty directory named “hello”, then create a file named hello.rb with the contents below.

Execute:

mkdir hello
cd hello

File: hello.rb

puts "Hello, World"

Create the Repository 02

You now have a directory with a single file. To create a git repository from that directory, run the git init command.

Execute:

git init

Output:

$ git init
warning: templates not found /Users/tonywok/.git_template
Initialized empty Git repository in /Users/tonywok/src/git_immersion/auto/hello/.git/

Add the program to the repository 03

Now let’s add the “Hello, World” program to the repository.

Execute:

git add hello.rb
git commit -m "First Commit"

You should see …

Output:

$ git add hello.rb
$ git commit -m "First Commit"
[master (root-commit) cf466b4] First Commit
 1 file changed, 1 insertion(+)
 create mode 100644 hello.rb

Table of Contents