Boss says: I want a Ruby app!!!
You type into command line:
mkdir git_demo
cd git_demo
touch hello.rb
- open hello.rb and type
puts 'hello' save the file
touch goodbye.rb
- open goodbye.rb and type
puts 'goodbye' save the file
Boss says: If you lose the source code, you are fired!
You type into command line:
git init (initializes your git repository)
git status (shows a summary of changes made to working directory – you have two untracked files)
git add hello.rb (adds a single file, hello.rb to staging)
git status (shows that hello.rb is now added and is ready to be commited. goodbye.rb is not ready to be committed.)
git add . (adds all files to staging – in this case, just goodbye.rb)
git status (shows that both hello.rb and goodbye.rb are staged for the next commit)
git commit -m "first commit" (commits files you added to staging index to the git repo)
then you go to github, create an account, go to your dashboard, click on “New Repository”, fill out “project name” with “git_demo” and “description” with a description.
at the command line you type:
git remote add origin git@github.com:<your user name>/git_demo.git
git push origin master
go to your github account and admire your new repository!
[...] Git Basics [...]