Workflow & Tools
Git & GitHub
My safety net as a developer. How I use version control to code without fear and never lose data again.
I don't see Git as a "tool for uploading," but as a time machine. If I make a mistake, I can rewind. If I test a feature, I can create a parallel reality (branch).
Here is my personal cheat sheet for everyday use. No theory, just the commands I actually use.
1. Visualization: What's actually happening?
Click on the buttons to understand how commits build on each other and how branches work. Merging simply means bringing two timelines back together.
2. The Daily Workflow
These are the commands I type 90% of the time. When I start in the morning or finish a feature.
Setup
# 1. Repo klonen (Der Standard)
git clone https://github.com/username/repo.git
# 2. Oder neues Projekt starten
git init
git remote add origin https://github.com/username/repo.gitRoutine
# 1. Status checken (Mein meistgenutzter Befehl)
git status
# 2. Alles stagen
git add .
# 3. Speichern (Commit)
git commit -m "feat: add new login button"
# 4. Hochladen
git push3. Working with Branches
I never work directly on the main branch. For every ticket, I create my own "feature branch." This keeps the main version clean and functional.
# Neuen Branch erstellen und direkt hinwechseln
git checkout -b feature/login-page
# Zurück zu main wechseln
git checkout main
# Branch löschen (wenn fertig)
git branch -d feature/login-page4. Panic Room (Emergency Commands)
I often look this up myself. What to do when you're stuck?
# "Ich habe Mist gebaut, mach alles wie beim letzten Commit"
git reset --hard
# "Ich habe aus Versehen committed, will aber weiterarbeiten"
# (Behält Änderungen, löscht nur den Commit)
git reset --soft HEAD~1
# "Ich will Änderungen temporär parken, um Branch zu wechseln"
git stash
# Später wiederholen:
git stash popGit Stash is my best friend. If the boss comes in and says 'Fix this quickly on Main,' but I'm in the middle of a feature: git stash -> Do the hotfix -> git stash pop. Everything is back.
5. Pro Tip: Aliases
I'm lazy. I don't want to type git status every time. That's why I created shortcuts (aliases).
# In deiner .gitconfig (oder Terminal):
git config --global alias.s "status"
git config --global alias.c "commit -m"
git config --global alias.co "checkout"
# Jetzt kannst du tippen:
git s # statt git status
git c "msg" # statt git commit -m "msg"