Skip to content

git

Created on Dec 4, ’22 ・ Updated on Mar 7, ’23

Resources

Commits

Tags

  • List tags with message: git tag -n
  • Create annotated tag and push:
    • git tag -a -m <tag message> <tag name> [commit hash]
    • git push --tags or git push <remote> <tag name>
  • Remove tag that is already pushed:
    • remove tag on remote with git push origin :refs/tags/<tag name>, : stands for --delete
    • replace tag locally with git tag -af <tag annotation> <commit hash>, -f means replace existing tag.
    • force push tags with git push --tags -f

Config

# disable pager mode when doing git branch
git config --global pager.branch false

# set a global gitignore file
git config --global core.excludesfile ~/.config/git/global-ignore

# aliases
git config --global alias.co checkout

Misc

  • git fetch/pull -p
    • Removes any remote-tracking references that no longer exist on the remote.
  • git show
    • Show changes in latest commit.
  • git log --oneline --graph --all
    • Nice view of commit history
  • git add -p