Initialise Git and create a new repository or clone an existent one:
git init <directory>git clone <repo> <directory>Create a new branch and start working on it:
git branch <name-of-branch>
git checkout <name-of-branch>Add all file changes in working directory to staging area:
git add -ACommit changes:
git commit -m 'Message'Inspect repository:
git statusMerge changes on a branch to master:
git checkout master
git merge <branch_name>Inspect commit log:
git log
or
git log --onelineUndo changes:
git revert HEAD
or
git checkout <previous_commit_id>
or
git reset --hard <commit_id>Amend commit:
git commit --amendPush our changes to a remote repository:
git remote add origin <repository_URL>
git branch -M master
git pull
git push -u origin master (git push [alias] [branch])