.gitconfig 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. [pretty]
  2. concise = %C(yellow)%h%C(reset) %s %C(bold black)(%an, %ar)%C(reset)%C(bold blue)%d%C(reset)
  3. [alias]
  4. # When doing "git git log" or some such, do not complain about "git" not
  5. # being a valid Git command. This happens when copy-pasting examples, for
  6. # instance.
  7. git = !git
  8. # Show a concise status of the working directory, along with the branch
  9. # and the number of commits behind and/or ahead.
  10. st = status --short --branch
  11. # Quickly push to the most common destination.
  12. pom = push origin master
  13. # Quickly push to the origin
  14. po = push origin
  15. # Quickly pull from the origin
  16. pu = pull origin
  17. # I know "pum" could just as well stand for "PUsh" instead of "PUll", but
  18. # I am so used to "git pom" that "git pum" feels like a natural
  19. # counterpart. I always try to rebase to prevent unnecessary merge
  20. # commits.
  21. pum = pull --rebase origin master
  22. # Show the staged changes.
  23. dc = diff --cached
  24. # Commit
  25. ci = commit
  26. # Like "git show myfile", but uses the last commit that changed "myfile".
  27. sl = log -n 1 -p
  28. # Switch branches, creating them if necessary. I want to unlearn using
  29. # "git checkout" for switching between branches because of the possible
  30. # dataloss when not paying attention. (You could see the PEBKAC, but I
  31. # could reply with another four letter acronym, slightly resembling TOFU.)
  32. #
  33. # Suppose I have modified a file named "password" and have two branches,
  34. # "password-expiry-mechanism" and "password-reset-mail". If I want to
  35. # switch to either branch, I would type "git checkout pass<Tab><Enter>",
  36. # but the autocomplete would stop at "git checkout password" because of
  37. # the ambiguity. Because I press <Enter> without really thinking, I have
  38. # now reset my "password" file. With "git go pass<Tab><Enter>", I would
  39. # simply have created a new branch called "password". (I would be forced
  40. # to use "--" to separate paths from banch names, which is a Good Thing™.)
  41. cob = checkout -B
  42. co = checkout
  43. # Make life easier, we only need git aa to add/remove git files
  44. aa = add --all
  45. # Show pretty log
  46. ll = !git pgl --all
  47. # Show only 20 git log items
  48. l = !git pgl -20
  49. # Show a git log with detailed log information.
  50. pgl = "!source ~/.githelpers && pretty_git_log"
  51. [core]
  52. excludesfile = ~/.gitignore
  53. autocrlf = input
  54. safecrlf = true
  55. [color]
  56. ui = true
  57. [merge]
  58. tool = vimdiff