GIT command line commands

I have been using GIT for more than 5 years now. I used GUI based software for cloning, committing, etc. tasks all these years. But with my current job which I joined a year ago, I have been using command line. I keep forgetting some of the commands and have to keeping searching the web. Today I thought I should probably make a note for myself here.

 

Check what files changed; i.e. modified, added or removed.
git status

 
Commit changes to Git. i.e. modified files, new files and removed files.
git add < file name with extension >
git commit -m " message you want to add to the commit "

Push changes to remote repository etc.
git push

 

Show all the branches on your local.
git branch

 

Adding existing source code files to the newly created repository.
 

Step 1:
git init

Step 2:

git add . Use . (dot) or * (asterisk) for adding all files.

git add < file name > Provide file name for adding single file

Step 3:

git commit -m "This will be my message to the commit."

Step 4:

git remote add origin < URL to the remote repository >

Step 5:

git push –u origin --all