Git Cheat Sheet
Konfigurera Git
git config --global user.name "namn"
git config --global user.email "email"
Skapa & Klona
git init # Skapa nytt repo
git clone URL # Klona repo
Grundläggande
git status # Se status
git add fil # Stage fil
git add . # Stage alla filer
git commit -m "" # Commit med meddelande
git log # Se historik
Branches
git branch # Lista branches
git branch namn # Skapa branch
git checkout namn # Byt branch
git merge namn # Merge branch
Remote
git remote -v # Lista remotes
git push origin branch # Pusha ändringar
git pull origin branch # Hämta ändringar
git fetch origin # Fetch utan merge
Ångra
git checkout -- fil # Ångra ändringar
git reset HEAD fil # Unstage fil
git revert commit # Ångra commit
Avancerat
git stash # Spara ändringar
git stash pop # Återställ ändringar
git cherry-pick commit # Kopiera commit
git rebase branch # Rebase branch