Initial Setup

Terminal Configuration
git config --global user.name "Akmal Avloni"
git config --global user.email "Akmal@Avloni.com
First git commit
# Have git will watch this directory for changes and create .git directory to store all tracking information.
git init

# After adding the necessary files to the project run this:
# it will add the files to the staging environment.
git add .

# Create your first commit:
# it will add the files to the local repository.
git commit -m "First commit"
First github push

Login to github.com and add an ssh key under profile (top right) > settings > ssh.
Create a new repo.
Run the following:

git remote add origin git@github.com:github_username/github_repository_name.git
git push -u origin master
Add a single file
# This will add the file to the staging environment.
git add file.txt

# Check files waiting to be committed in the staging environment:
git status

# Commit the file to the repo with the message "file.txt":
git commit -m "file.txt"
Which files in the current working directory differ from the repository?
git diff

# or check only for one filename
git diff filename.txt

# already staged the file and git diff not listing the differences between the working file and the repository file?
git diff --staged
Remove a file
git rm file.txt
git status
git commit -m "deleted file.txt"
Rename or move a file
git mv file.txt dirname/file2.txt
git status
git commit -m "moved and renamed file.txt to dirname/file2.txt"
Automatically add to stage and commit with -a option
git commit -am "hot fix in File1.txt"