Skip to content

Instantly share code, notes, and snippets.

@barinbritva
Last active February 21, 2024 17:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save barinbritva/74083e2a8fac3853b012 to your computer and use it in GitHub Desktop.
Save barinbritva/74083e2a8fac3853b012 to your computer and use it in GitHub Desktop.
Git commands
# Delete local tag
git tag -d tagname
# Delete remote tag
git push origin :tagname
# Or
git push --delete origin tagname
# Set author globally
git config --global user.name "Barin Britva"
git config --global user.email barinbritva@outlook.com
# Set author in project
git config user.name "Barin Britva"
git config user.email barinbritva@outlook.com
[user]
name = John Doe
email = john@doe.tld
[includeIf "gitdir:~/work/"]
path = ~/work/.gitconfig
# Amend commit
git commit --amend --no-edit
# Amend commit, change author
git commit --amend --author="Barin Britva <barinbritva@outlook.com>" --no-edit
# Remove commit
git reset --hard needed-commit-hash
git push origin -f
# Remove tag
# remote repository
git push --delete origin tagname
# locally
git tag --delete tagname
# Remove all tags
# remote repository
git tag -l | xargs -n 1 git push --delete origin
# locally
git tag | xargs git tag -d
# Specific SSH key
git clone -c "core.sshCommand=ssh -i ~/.ssh/id_rsa_work" git@github.com:corporateA/webapp.git
git config core.sshCommand "ssh -i ~/.ssh/id_rsa_work"
# Miscellaneous
# Add x permission in Windows
git update-index --chmod=+x script.sh
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment