Skip to content

Instantly share code, notes, and snippets.

@stablexbt
Created February 12, 2026 12:33
Show Gist options
  • Select an option

  • Save stablexbt/c8003e93acb50d6de90106b0ae93240a to your computer and use it in GitHub Desktop.

Select an option

Save stablexbt/c8003e93acb50d6de90106b0ae93240a to your computer and use it in GitHub Desktop.
Git essentials

Git

  • Clone repo
git clone <repo>
  • Init new git repo
git init
  • Pull current version
git pull
  • Add to staging are
git add .
  • Remove deleted from staging area
git rm -r .
  • Commit
git commit -m "<msg>"
  • Upload to Github
git push -u origin master
  • Git branch
git branch
  • Git change branch
git checkout <branchname>
  • overwrite and pull
git fetch --all
git reset --hard origin/master
  • Edit git config
git config --global --edit
  • Git config
 git config --global user.email "you@example.com"
 git config --global user.name "Your Name"

to set your account's default identity, Omit --global to set the identity only in this repository.

  • Git stash
git stash
  • Local User
# put in .git/config
[user]
	name = username
	email = email@gmail.com
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment