Below is a list of commonly used Git commands along with their usecase. This cheat sheet is designed to help you understand the basics of Git quickly.
git init # Initialize a new Git repository.
git clone <repository> # Clone an existing repository.
git status # Display the state of the working directory and staging area.
git add <file> # Add a file to the staging area.
git commit -m 'message' # Commit changes with a message.
git push # Push changes to the remote repository.
git pull # Fetch and merge changes from the remote repository.
git branch # List all branches in the repository.
git checkout <branch> # Switch to a different branch.
git merge <branch> # Merge a branch into the current branch.
git remote -v # Show all remote repositories.
git fetch # Download objects and refs from another repository.
git log # Show the commit history for the current branch.
git reset <file> # Unstage a file from the staging area.
git rm <file> # Remove a file from the working directory and stage the removal.
git stash # Stash changes in a dirty working directory away.
git stash pop # Apply the most recent stash and remove it from the stash list.
git rebase <branch> # Reapply commits on top of another base tip.
git tag <tag_name> # Create a tag for a specific commit.
git diff # Show changes between commits, commit and working tree, etc.
git config --global user.name 'name' # Set the username for all repositories on your system.
git config --global user.email 'email' # Set the email for all repositories on your system.
git revert <commit> # Create a new commit that undoes the changes made by a previous commit.
git show <commit> # Show information about a specific commit.
git mv <file> # Move or rename a file in the working directory.
Feel free to copy this entire block of commands and use them as needed in your Git workflow.