$ cd /home/user/my_project //enter project root folder
$ git init //initializing a repository
$ git add *.c // tracking existing file whit .c extension
$ git add LICENSE
$ git commit -m 'Initial project version' //commit
$ git clone https://github.com/libgit2/libgit2 //cloning existing repository in current folder
$ git clone https://github.com/libgit2/libgit2 mylibgit // rename
$ git status // check the status of your files
$ git add readme // tracking file readme
$ git diff //show you the exact lines added and removed
$ git diff --staged // show you what you've staged that will go into your next commit
$ git diff --cached // show you what you've staged so far (--staged and --cached are synonyms)
$ git rm --cache README // keep the file in your working tree but remove it from the staging area.
$ git rm log/\*.log // remove all files that have the .log extension in the log/ directory
$ git rm /*~ // remove all files whose names end with a ~
$ git mv file_from file_to // rename a file
$ git log //view log
$ git commmit --amend // redo the commit
$ git reset HEAD abc.md // unstage abc.md
$ git checkout -- <file> // discard changed in working directory
$ git restore --staged <file> // to unstage
$ git restore <file> // discard changes in working directory
$ git remote -v // see which remote servers you have configured
$ git remote add <shortname> <url> //explicitly add a new remote
$ git fetch <remote> //to get data from your remote projects
$ git push <remote> <branch> //push
$ git remote show <remote> // show more information of remote
$ git remote rename <oldname> <newname> //rename remote name
$ git remote remove <remote> // remove remote
$ git tag // list the existing tags
$ git tag -a v1.4 -m "my version 1.4" // create an annotated tag
$ git show v1.4 // show the tag
$ git tag v1.4-lw //create lightweight tag
$ git push origin v1.5 // must explicitly push
$ git push origin --tags //push a lot of tags at once
$ git tag -d v1.4-lw //delete tag locally
$ git push origin :refs/tags/v1.4-lw //The way to interpret the above is to read it as the null value before the colon is being pushed to the remote tag name, effectively deleting it.
$ git push origin --delete <tagname> //delete remotelly
$ git checkout 2.0.0 // view the version of file a tag is pointing to.