- Source code management (SCM) tool
- Developed by Linus Torvalds for the Linux kernel
- Keep track of source code in commits and branches
- Commit = “unit of code change”
…is just a folder with a special .git
directory.
Create a repository by typing
git init
within a directory.
Display modified files and their states:
git status git diff
Add a modified file to the staging area:
git add <FILE>
Commit all staged files:
git commit
Browse history
git log
List branches
git branch -v
Create a new branch from current commit
git branch <NAME>
Switch to another branch
git switch <NAME>
Create a file named .gitignore
in the git repository.
Example:
.Rhistory .RData *.nb.html plots/*.pdf
Configuration file at ~/.gitconfig
. Modify with text-editor or with git config
command.
When collaborating online, it is important to set your identity – it will be associated with every commit:
git config --global user.name "Your name" git config --global user.email "mail@example.com"