Git CheatSheet
Git CheatSheet
SETUP and user configuration
git config --global user.name “[firstname lastname]”
git config --global user.email “[valid-email]”
git config --global color.ui auto
Working with Branches
Command Function
git merge <branch> Merges the specified branch into the current branch.
Staging and Commit Commands
Command Function
Working with Remote Repositories
Command Function
git reset --hard Resets the working directory to the last commit.
Git Stash Commands
Command Function
Use Case When you need to temporarily set When you're ready to finalize and
aside changes to switch branches, pull document the changes as part of
updates, or do other work. the repository's history.
Visibility Stashed changes are private to you; Commits are public and become
they don't appear in the repository part of the repository's history.
history.
Data Storage Stores changes in a "stash" list that can Stores changes in the repository's
be reapplied or discarded later. history, which is synchronized with
remote repositories.
Command git stash, git stash apply, git git commit -m "<message>",
Examples stash list, git stash drop git commit --amend