Git Cheatsheet

First config

ssh-keygen -t rsa -C "misostack.com@gmail.com"
git config --global user.name "misostack"
git config --global user.email "misostack.com@gmail.com"

Delete Multiple Local Branches

git branch | grep ‘your_string_here’

Delete it remotely too.

git branch | grep ‘your_string_here’ | xargs git push origin — delete

Example

git branch -D `git branch | grep -vE 'master|develop|release/*'`

Disabled Push

git remote set-url --push origin DISABLE # important, you can not push directly on origin repo

Tags

# create new tag
git tag tagName
git push --tags
# delete local tag
git tag -d 12345
# delete remote tag '12345' (eg, GitHub version too)
git push origin :refs/tags/12345
# alternative approach
git push --delete origin tagName

git tag -d tagName

cannot lock ref 'refs/remotes/origin

Root cause : image

Answered

git fetch --prune
Last Updated:
Contributors: misostack