Initialize a new git repository
git initSet configuration values for your username and email
git config --global user.name <your-name>
git config --global user.email <your-email>Clone a repository
git clone <repository-url>Add a file to the staging area
git add <file>Add all files changes to the staging area
git addCheck the unstaged changes
git diffCommit the staged changes
git commit -m "message"Reset staging area to the last commit
git resetCheck the state of the working directory and the staging area
git statusRemove a file from the index and working directory
git rm ‹file>List the commit history
git logCheck the metadata and content changes of the commit
git show <commit-hash>Lists all local branches
git branchCreate a new branch
git branch <branch-name>Rename the current branch
git branch -m <new-branch-name>Delete a branch
git branch -d <branch-name>Switch to another branch
git checkout <branch-name>Merge specified branch into the current branch
git merge <branch-name>Create a new connection to a remote repository
git remote add <name> <repository-url>Remove connection to a remote repository
git remote remove <name>Update connection to a remote repository
git remote set-url <name> <repository-url>View connection to a remote repository
git remote get-url <name>Push the committed changes to a remote repository
git push <remote> <branch>Download the content from a remote repository
git pull <remote>Cleanup unnecessary files and optimize the local repository
git gcTemporarily remove uncommitted changes and save them for later use
git stashReapply previously stashed changes
git stash applyLast updated on