Skip to content

lab 3 Create a Project

Goals

Create a “Hello, World” program

Starting in the empty working directory, create an empty directory named “hello”, then create two files named hello.js and start.js with the contents below.

Execute:

mkdir hello
cd hello

hello.js

console.log("Hello, World");

start.js

const { sayHello } = require('./hello');

  sayHello();

Create the Repository

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
Initialized empty Git repository in /Users/opsparkowl/Documents/opspark/dev_shop/git-immersion/auto/hello/.git/

Add the program to the repository

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

Execute:

git add hello.js
git add start.js
git commit -m "First Commit"

You should see …

Output:

$ git add hello.js
$ git add start.js
$ git commit -m "First Commit"
[main (root-commit) 284070d] First Commit
 2 files changed, 2 insertion(+)
 create mode 100644 hello.js
 create mode 100644 start.js