git init
- Creates an empty Git repository or reinitializes an existing one.
git add
- Adds a file to the staging area to prepare it for a commit.
git commit
- Create a new commit and records changes into the repository.
git push
- Push changes made to the remote master branch of a repository.
git pull
- Pull any changes made from the remote master branch to the local machine.
git status
- Displays the state of the working directory and the staging area.
- Open a terminal and create project folder on local machine and cd into it
mkdir Example_Project
cd Example_Project
- Initialize the folder and add initial commit
git init
git commit -m 'Initial commit'
- Create an example ruby program and add some code with your text editor
touch example.rb
-
puts "Here is some example code"
- Add example.rb to the staging area
git add example.rb
- Commit changes and check status of working directory
git commit -m 'Add code to example.rb'
git status
- Push changes to the remote master branch
git push