latentspace.

git Commands Cheat Sheet


  • git Commands Cheat Sheet

  • Command Description
    git checkout . Discard all local changes
    git checkout -b <branch name> Create and checkout branch
    git branch Show all branches
    git branch -D <branch name> Remove specific branch forcedly
    git stash Temporarily save uncommitted changes
    git stash pop Apply the most recently stashed changes
    git reset HEAD^ Undo the last commit (--soft, --mixed, --hard)
    git tag <tag name> Create a new tag at the current commit
    git push origin <tag name> Push a specific tag to the remote repository
    git push origin --tags; Push all tags to remote repository
    git cherry-pick <commit hash> Apply specific commit to the current branch
    git push origin -d <branch name> Delete a branch from remote repository
    git push --set-upstream origin <branch name> Push the branch to the remote repository and set it as the upstream branch
    git commit -a --no-verify Commit all changes without verification