Git cheatsheet
Save every version of your code and never lose work
How it works
- Initialise — git init turns a folder into a repository.
- Stage — git add chooses which changes go into the next save.
- Commit — git commit stores a snapshot with a message.
- Share — git push uploads your commits to GitHub or GitLab.
First steps
git init- Start a repository
git status- See what changed
git add . && git commit -m "first"- Save your changes
git log --oneline- Read the history
git switch -c new-idea- Create and move to a branch