Cloning a remote repository:
$ git clone https://github.com/OpenVPN/openvpn-build.git
Cloning a remote repository with preserving UNIX-style line endings:
$ git clone https://github.com/OpenVPN/openvpn-build.git --config core.autocrlf=false
Checking out the status of the current local repository:
$ git status
Getting a list of all remote branches:
$ git branch -r
origin/HEAD -> origin/master
Checking out the remote branch:
$ git checkout -b
$ git checkout -b release/2.3 origin/release/2.3
Branch release/2.3 set up to track remote branch release/2.3 from origin.
Switched to a new branch 'release/2.3'
Checking the name of the remote:
$ git remote
Adding changed file (already tracked but modified) or new file to the commit:
$ git add my_file
The same applies for directories.
Saving changes in the repository:
$ git commit
Git will prompt you to enter the commit message (in vi editor; ESC to exit editing mode, :wq to save changes and quit)
Previous two actions can be done in one go with the following:
$ git commit -a -m "Code updated"
To view all differences in modified file:
$ git diff my_file
To view all differences in all modified files in the current directory:
$ git diff .