Basic git commands

Here is a list of some basic Git commands that will help you get started with git.

Checkout a new branch

git clone git-repo-url
eg:-
git clone https://github.com/roymj88/git-helper.git

Create a new local repository

git init

Create a new branch from current working branch and switch to it

git checkout -b <new-branch-name>

Switch to a new branch

git branch <branch-name>

List all available branches

git branch

Check status of files

git status

Add files for commit

git add <file-name>
OR
git add <file-name-1> <file-name-2> <file-name3>
OR
git add *

Remove files for commit

git rm <file-name>

Commit

git commit -m "Message for commit"

Pull – Update local repo with latest update from server

git pull

Push – Update changes to repository

git push origin master
#Updates 'master' branch
git push origin <branch-name>
#Updates corresponding branch

Stash – Store changes without commiting

git stash

Stash Apply – Apply stashed changes

git stash apply

Merge

git merge <branch-name>
#Merges a different branch into your active branch

View more at : https://github.com/roymj88/git-commands-helper