Create a new repository on the command line

→ echo "# Repo-Name" >> README.md

→ git init

→ git add README.md

→ git commit -m "first commit"

→ git branch -M master

→ git remote add origin https://github.com/user-name/repo-name.git

→ git push -u origin master

Push an existing repository from the command line

→ git remote add origin https://github.com/user-name/repo-name.git

→ git branch -M master

→ git push -u origin master

Viewing the Commit History

→ git log

→ git log --oneline (for printing each commit on a single line.)

Branch and Merge

→ git branch (To list all branches)

→ git branch [branch-name] (for creating a new branch)

→ git checkout [branch-name] (for switching to another branch)

→ git merge [branch-name] (for merging the specified branch’s history into the current one)