Installation
To install git for the current user, run:
Graphical front-ends
Configuration
Usage
Creating a Git repository
To create a new git repository, in the current directory, do:
A message should confirm the creation of the repository:
Initialized empty Git repository in /root/test/.git/
Getting a Git repository
To clone an existing git repository, do:
$ git clone https://github.com/MunGell/awesome-for-beginners.git
This will create a new folder awesome-for-beginners
. To go to the new folder:
$ cd awesome-for-beginners
Recording changes
After you’ve made some changes, commit them to the git repository, to permanently save the current version.
Staging changes
To add all changed, files to the commit, do:
To add individual, changed files to the commit, do:
To see all files, that will be added to the commit, do:
If you like to clear the staging area, and start again, do:
Committing changes
To commit the changes you’ve made, make sure that you’ve added them to the staging area with git add .
and reviewed all changes with git status
. Now go ahead, and commit (save) the changes:
$ git commit -m "file: revised instructions"
It’s good practice, to add short but clear commit messages.
Revision selection
Viewing changes
Undoing things
Branching
Collaboration
Pull requests
Using remotes
Push to a repository
Dealing with merges
History and versioning
Searching the history
Tagging
Organizing commits
Tips and tricks
Using multiple SSH keys
Create ~/.ssh/config
and define all domains, and keys you’d like to use.
host git.domain1.com
HostName git.domain1.com
IdentityFile ~/.ssh/key1
User git
host git.domain2.com
HostName git.domain2.com
IdentityFile ~/.ssh/key2
User git
Using git-config
Adopting a good etiquette
Speeding up authentication
Protocol defaults
Bash completion
Git prompt
Visual representation
Commit tips
Signing commits
Working with a non-master branch
Directly sending patches to a mailing list
When the remote repo is huge
Simplest way: fetch the entire repo
Partial fetch
Get other branches
Possible Future alternative
See also