Skip to content

Instantly share code, notes, and snippets.

@nopeless
Last active September 9, 2021 12:37
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 nopeless/11e0c72b8546003aed2da44de4b96d38 to your computer and use it in GitHub Desktop.
Save nopeless/11e0c72b8546003aed2da44de4b96d38 to your computer and use it in GitHub Desktop.
Git snippets
# basics
# oh frik the commit message was wrong
git commit -a --amend -m "new message"
# or
git commit -a --amend --no-edit
# set remote
git remote set-url origin url
# other stuff
# git rebase (rebase is op dont forget the -i and remember to set the text editor to npp or a text editor that is light)
git rebase -i SHA^
# use this when testing github actions
git commit -a --amend --no-edit && git push -f
# reflogs
# show list
git reflog
# reset to specific point
git reset HEAD@{<number>}
# for powershell, use
git reset "HEAD@{<number>}"
# pretty tree
git log --graph --pretty=oneline --abbrev-commit
# pretty tree w other branches
git log --graph --pretty=oneline --abbrev-commit --all
# show other branches as well
git log --all
# tagging
# show current tag
git tag --points-at HEAD
# create tag
git tag <tag>
# tag with annotation
git tag -a <tag> -m <message>
# delete
git tag -d
# push with tag
git push origin : <tag>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment