You can run git help in the terminal to learn about many of these commands at any time. git help -a and git help -g list available subcommands and
concept guides. git help <command> or git help <concept> allow you to read about a specific subcommand or concept.
HEAD represents your current working directory. The HEAD pointer can be moved to different branches, tags, or commits using git checkout.
The gitignore file allows you to control what gets committed and what doesn't, allowing you to keep your keys and passwords secure, and reducing the amount of bloat on the remote repo. You can learn more about it in the .gitignore file above.
HEY! Changing your history may cause undesired side effects. You may lose data. Many of these commands cannot be undone. If you change your remote history, don't say I didn't warn you.
Command
Description
git rebase <branch>
Reapply commits on top of another base tip
git rebase -i <commitID>
Reapply all commits from <commitID forward
git cherry-pick <commitID>
Apply the changes introduced by some existing commits
git clean -f
Removes and deletes untracked files from the working tree
git clean -fd
Remove all untracked directories
git commit --amend
Allows you to edit a previous commit that has not been pushed
git commit --fixup <commitID>
Combine new changes with an existing commit under the same name
git reset <commitID>
Reverts all commits after specified commit, while keeping local changes
git reset --hard <commitID>
Reverts all history and changes back to the given commit
git reset HEAD~1
Revert 1 commit (while keeping current local state)
git push origin <branch> --force
Deletes all your previous commits and pushes your current one
๐ More Git Resources
Git Docs, for those who want to dive deep into the documentation