Skip to content

Git Miscellaneous

Links: 106 Git Index

Setting up Aliases

  • We can add aliases in the ~/.gitconfig file
  • By default you will have your name and email there
  • We can also define these aliases in our .bashrc file
      co = checkout
      ci = commit
      st = status
      br = branch
      hist = log --pretty=format:\"%h %ad | %s%d [%an]\" --graph --date=short
      type = cat-file -t
      dump = cat-file -p

Using a different user

  • You will first need to change the username and email in ~/.gitconfig file
    # This is Git's per-user configuration file.
        name = Sarthak Narayan
        email =
    # Please adapt and uncomment the following lines:
    #   name = Sarthak Narayan
    #   email = sarthaknarayan@Sarthaks-MacBook-Air.local
  • Then after getting the token from your GitHub account you will need to to add it to ~/.gitcredentials file

Last updated: 2022-06-08