
git (not git-core), the default branch is usually main and the modern SSH key is Ed25519. The history — BitKeeper, the ten days of 2005, Junio Hamano, Git 2.55 — is in The history of Git.A short cheatsheet: install, configure, clone, commit, push. No object theory. If you've never used Git, these commands handle 90% of cases.
Install
Debian/Ubuntu and derivatives:
sudo apt update
sudo apt install git
git --version
In 2026 the package is git. The old name git-core was a metapackage; don't look for it.
Name, email and default branch
git config --global user.name "Seu Nome"
git config --global user.email seu@email.com
git config --global init.defaultBranch main
git config --global pull.rebase false
user.name and user.email go into every commit. Without them Git complains. The industry's default branch stopped being master around 2020; main is what GitHub, GitLab and Git itself use for a new repository.
SSH key
Ed25519, not RSA 4096 — smaller and the current default. Details of the passwordless workflow: Passwordless SSH.
ssh-keygen -t ed25519 -C "seu@email.com"
eval "$(ssh-agent -s)"
ssh-add ~/.ssh/id_ed25519
cat ~/.ssh/id_ed25519.pub
Paste the public key into GitHub/GitLab → Settings → SSH keys. Test:
ssh -T git@github.com
New repository or clone
mkdir projeto && cd projeto
git init
# ou, o caso comum:
git clone git@github.com:usuario/projeto.git
cd projeto
Add, commit, status
git status
git add arquivo.txt # ou: git add -A
git commit -m "mensagem curta no imperativo"
git log --oneline -5
The commit stays in the local repository. It isn't on GitHub yet.
Branch: switch, not just checkout
git switch -c feature/login # cria e entra
git switch main # volta
git merge feature/login
git branch -d feature/login
git switch and git restore (undo file changes) have existed since Git 2.23 (2019) and separate the tasks that checkout used to combine. checkout still works; for new code, use the two new commands.
git restore arquivo.txt # descarta mudança no working tree
git restore --staged arquivo.txt # tira do index, mantém o arquivo
Remote and push
git remote add origin git@github.com:usuario/projeto.git
git push -u origin main
Next time: git push and git pull. The -u records the upstream. If the remote still uses master, change the branch name — don't invent main on a remote that doesn't have it.
git branch -M main # só se você está migrando um repo antigo
A day's workflow
git pull
git switch -c fix/typo
# edita
git add -A
git commit -m "Corrige typo no README"
git push -u origin fix/typo
# abre o pull request no GitHub/GitLab
git switch main
Video: Git Made Simple (LinuxTips)
Jeferson Fernando's LinuxTips recorded “Descomplicando o GIT” — still the best Portuguese-language walkthrough of the workflow. The history (BitKeeper, the ten days, Git 2.55) is in the new post.
More
- The history of Git — BitKeeper, Linus, Junio, 2.55
- The history of Linus Torvalds
- Pro Git (official book, v2 in Portuguese)
- Two decades of Git — interview with Linus (2025)