Essentials
Introduction
Git is a decentralized version management software: It allows to store data remotely but also locally. Git does not rely on a centralized server, but uses a peer-to-peer connection system. The developed computer code is stored not only on the computer of each project contributor, but it can also be stored on a dedicated server (Remote).
Git init
Initialize a .git repository. It can be used to convert an existing, unversioned project to a Git repository or initialize a new, empty repository.
Git config
Setup user details. Git will associate them with locally created commits.
To see current config :
Git status
Get informations about the current git directory (Untracked/new/changed/removed files)
Git add/reset
Add/remove files from git tracking
Git add
Add to tracking (Stage changes)
Info
readme.md file is staged
Info
Every HTML files are staged
Tip
Every available files are staged.
You should git status
first to make sure you are not tracking unwanted files.
Git reset
Remove files from git tracking
Info
readme.md file is not tracked anymore (But changes made to the file remain unchanged)
Info
Cancels all last git add (Unstage all)
Git commit
Commit changes to git. Only tracked files are committed. You can add files and commit with the same command line
Git log
Git logging to see details about commits.
- Git log : Basic operation
- Oneline : Use One-line Display
- File Specific : Display commits associated with a specific file
Git diff
Display what changed since last commit
Gitignore
Setup files to ignore when versioning with a .gitignore file