Git is a free and open source distributed version control system designed to handle everything from small to very large projects with speed and efficiency.
Git is easy to learn and has a tiny footprint with lightning fast performance. It outclasses SCM tools like Subversion, CVS, Perforce, and ClearCase with features like cheap local branching, convenient staging areas, and multiple workflows.
By: Git
Download latest source release
Download latest source release
$ sudo add-apt-repository ppa:git-core/ppa -y
$ sudo apt-get update
$ sudo apt-get install git -y
Access the list here
Commands (All)
-
config - Get and set repository or global options
Open the terminal and type the commands:
Username:
$ git config --global user.name "your_name"
E-mail:
$ git config --global user.email "your_email"
Editor:
$ git config --global core.editor "your_fav_editor"
Git config editor:
Editor | Config Command |
---|---|
VS Code | $ git config --global core.editor "code --wait" |
Atom | $ git config --global core.editor "atom --wait" |
emacs | $ git config --global core.editor "emacs" |
nano | $ git config --global core.editor "nano -w" |
vim | $ git config --global core.editor "vim" |
Textmate | $ git config --global core.editor "mate -w" |
Sublime Text (Mac) | $ git config --global core.editor "subl -n -w" |
Sublime Text (Win x86) | $ git config --global core.editor "'c:/program files (x86)/sublime text 3/sublimetext.exe' -w" |
Sublime Text (Win x64) | $ git config --global core.editor "'c:/program files/sublime text 3/sublimetext.exe' -w" |
Display settings:
$ git config <key>
Example:
$ git config user.name
$ git config user.email
$ git config --list
-
init - Create an empty Git repository or reinitialize an existing one
$ git init
-
clone - Clone a repository into a new directory
$ git clone <repository>
-
satus - Show the working tree status
$ git status
-
add - Add file contents to the index
One file:
$ git add <file_name>
All files:
$ git add *
-
rm - Remove files from the working tree and from the index
One File:
$ git rm --cached <file_name>
All files:
$ git rm --cached *
-
commit - Record changes to the repository
$ git commit -m "comment"
-
reset - Reset current HEAD to the specified state
$ git reset HEAD <file_name>
-
branch - List, create, or delete branches
$ git branch
Create a new branch with checkout:
$ git checkout -b <branch_name>
-
log - Show commit logs
$ git log <options>
-
checkout - Switch branches or restore working tree files
$ git checkout <file_name>
-
push - Update remote refs along with associated objects
$ git push
-
shortlog - Summarize git log output
$ git shortlog <options>
-
diff - Show changes between commits, commit and working tree, etc
$ git diff <options>
- Open your terminal
- Paste the command below, substituting in your GitHub email address
$ ssh-keygen -t rsa -b 4096 -C "your_email@example.com"
- Press Enter for this accepts the default file location
> Enter a file in which to save the key (/c/Users/you/.ssh/id_rsa):[Press enter]
- Type a secure passphrase and confirm (optional)
> Enter passphrase (empty for no passphrase): [Type a passphrase]
> Enter same passphrase again: [Type passphrase again]
- Enter the folder containing your key (default path is .ssh)
$ cd ~/.ssh
- Get the key from the id_rsa.pub file with the command below
With cat command:
$ cat id_rsa.pub
With more command:
$ more id_rsa.pub