git
Linux · Packages · reference only
What it does
Version control system: it keeps a project's change history and lets you go back, branch and collaborate.
Syntax
git orden [opciones]
Options and parameters
initCreates a new repository in the current directory.
statusShows which files changed and which are staged for the commit.
add ficheroStages changes for the next commit; add . stages them all.
commit -m "mensaje"Saves the staged changes in the history, with a message.
log --onelineShows the commit history, one line each.
config --global clave valorConfigures Git for your user, such as user.name and user.email.
branch [nombre]Lists branches or creates a new one.
Usage examples
git initTurns the current directory into a repository.
git statusChecks the state of the working directory.
git add informe.txt && git commit -m "Añade el informe"Stages a file and saves it in the history.
git log --onelineReviews the history compactly.
git config --global user.name "Ana"Sets the name that will appear on your commits.
git branch pruebasCreates a branch called pruebas.
Notes and common mistakes
- Git stores each commit with an identity: set user.name and user.email before the first one.
- Simulator scope: init, status, add, commit, log, config and branch.