Skip to content

Instantly share code, notes, and snippets.

@barinbritva
Last active February 21, 2024 17:00
Show Gist options
  • 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 [email protected]
# Set author in project
git config user.name "Barin Britva"
git config user.email [email protected]
[user]
name = John Doe
email = [email protected]
[includeIf "gitdir:~/work/"]
path = ~/work/.gitconfig
# Amend commit
git commit --amend --no-edit
# Amend commit, change author
git commit --amend --author="Barin Britva <[email protected]>" --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" [email protected]: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