Written on . Last updated on .

Random Git notes.

Change Origin

git remote set-url origin <remote_url>

Delete Remote Tag

git tag -d 1.0.0
git push origin :refs/tags/1.0.0 

Prune Local Branches and Tags

git fetch --prune --prune-tags

Move Latest Commit to Another Branch

git checkout newbranch
git merge main
git checkout main
git reset --hard HEAD~1
git checkout newbranch

Unstage Files

git reset <commit> -- .

Checkout File From Specific Branch

git checkout main -- path/to/file