Create a Project
Goals
- Learn how to create a git repository from scratch.
Create a “Hello, World” program
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
hello.rb
puts "Hello, World"
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/jim/Downloads/git_tutorial/work/hello/.git/
Add the program to the repository
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) 4445720] First Commit
1 file changed, 1 insertion(+)
create mode 100644 hello.rb
当前内容版权归 gitimmersion 或其关联方所有,如需对内容或内容相关联开源项目进行关注与资助,请访问 gitimmersion .