Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Git Notes and GitHub

Git Notes and GitHub

Git has a little used feature called Notes that is an excellent support to traditional commit messages. Not surprisingly, this feature also has a great visual rendering on the GitHub.com site when Notes are pushed to a Git repository.

Bededa744012c87721d68f69342f81b0?s=128

Matthew McCullough

April 21, 2012
Tweet

Transcript

  1. GIT NOTES & GITHUB

  2. GIT NOTES & GITHUB A Parallel Message Set

  3. Notes

  4. None
  5. • Object pointing to a commit • Supplemental to commit

    messages • Namespaced for grouping of notes
  6. • Object pointing to a commit • Supplemental to commit

    messages • Namespaced for grouping of notes
  7. • Object pointing to a commit • Supplemental to commit

    messages • Namespaced for grouping of notes
  8. None
  9. — Git notes man page A typical use of notes

    is to supplement a commit message without changing the commit itself.
  10. The Basics

  11. GIT-NOTES(1) Git Manual GIT-NOTES(1) NAME git-notes - Add or inspect

    object notes SYNOPSIS git notes [list [<object>]] git notes add [-f] [-F <file> | -m <msg> | (-c | -C) <object>] [<object>] git notes copy [-f] ( --stdin | <from-object> <to-object> ) git notes append [-F <file> | -m <msg> | (-c | -C) <object>] [<object>] git notes edit [<object>] git notes show [<object>] git notes merge [-v | -q] [-s <strategy> ] <notes_ref> git notes merge --commit [-v | -q] git notes merge --abort [-v | -q] git notes remove [--ignore-missing] [--stdin] [<object>...] git notes prune [-n | -v] git notes get-ref
  12. GIT-NOTES(1) Git Manual GIT-NOTES(1) NAME git-notes - Add or inspect

    object notes SYNOPSIS git notes [list [<object>]] git notes add [-f] [-F <file> | -m <msg> | (-c | -C) <object>] [<object>] git notes copy [-f] ( --stdin | <from-object> <to-object> ) git notes append [-F <file> | -m <msg> | (-c | -C) <object>] [<object>] git notes edit [<object>] git notes show [<object>] git notes merge [-v | -q] [-s <strategy> ] <notes_ref> git notes merge --commit [-v | -q] git notes merge --abort [-v | -q] git notes remove [--ignore-missing] [--stdin] [<object>...] git notes prune [-n | -v] git notes get-ref
  13. Create a note

  14. $ git notes add -m”<SOMENOTEMESSAGE>”

  15. Video

  16. Examine the directory structure

  17. $ tree .git/refs/notes

  18. Video

  19. Displaying notes

  20. $ git notes show <COMMIT>

  21. Video

  22. $ git log <COMMIT>

  23. Video

  24. Namespacing

  25. Default namespace is commits

  26. $ git notes --ref <OTHERREF> add -m”<SOMENOTEMESSAGE>”

  27. Video

  28. Viewing a different namespace

  29. $ git notes --ref jenkins show <COMMIT>

  30. Video

  31. $ git log --show-notes=jenkins

  32. Video

  33. $ git log --show-notes=*

  34. Video

  35. Pushing

  36. Notes don’t push by default

  37. git push origin refs/notes/commits // or git push origin refs/notes/jenkins

    // or git push origin refs/notes/*
  38. Video

  39. $ git config --global alias.pushnotes "\!sh -c 'git push \$1

    refs/notes/*' -" $ git pushnotes origin
  40. Fetching

  41. Notes don’t fetch by default

  42. $ git fetch origin refs/notes/commits:refs/notes/commits // or $ git fetch

    origin refs/notes/jenkins:refs/notes/jenkins // or $ git fetch origin refs/notes/*:refs/notes/*
  43. Video

  44. $ git config --global alias.fetchnotes\ "\!sh -c 'git fetch \$1

    refs/notes/*:refs/notes/*' -"
  45. $ vim .git/config ...and edit [remote ”origin”] fetch = +refs/heads/*:refs/remotes/origin/*

    ...to be [remote ”origin”] fetch = +refs/heads/*:refs/remotes/origin/* fetch = +refs/notes/*:refs/notes/*
  46. GitHub

  47. Notes are shown with commits

  48. Video

  49. More?

  50. Notes can be appended

  51. GIT-NOTES(1) Git Manual GIT-NOTES(1) NAME git-notes - Add or inspect

    object notes SYNOPSIS git notes [list [<object>]] git notes add [-f] [-F <file> | -m <msg> | (-c | -C) <object>] [<object>] git notes copy [-f] ( --stdin | <from-object> <to-object> ) git notes append [-F <file> | -m <msg> | (-c | -C) <object>] [<object>] git notes edit [<object>] git notes show [<object>] git notes merge [-v | -q] [-s <strategy> ] <notes_ref> git notes merge --commit [-v | -q] git notes merge --abort [-v | -q] git notes remove [--ignore-missing] [--stdin] [<object>...] git notes prune [-n | -v] git notes get-ref
  52. GIT-NOTES(1) Git Manual GIT-NOTES(1) NAME git-notes - Add or inspect

    object notes SYNOPSIS git notes [list [<object>]] git notes add [-f] [-F <file> | -m <msg> | (-c | -C) <object>] [<object>] git notes copy [-f] ( --stdin | <from-object> <to-object> ) git notes append [-F <file> | -m <msg> | (-c | -C) <object>] [<object>] git notes edit [<object>] git notes show [<object>] git notes merge [-v | -q] [-s <strategy> ] <notes_ref> git notes merge --commit [-v | -q] git notes merge --abort [-v | -q] git notes remove [--ignore-missing] [--stdin] [<object>...] git notes prune [-n | -v] git notes get-ref
  53. None
  54. Notes can be merged

  55. GIT-NOTES(1) Git Manual GIT-NOTES(1) NAME git-notes - Add or inspect

    object notes SYNOPSIS git notes [list [<object>]] git notes add [-f] [-F <file> | -m <msg> | (-c | -C) <object>] [<object>] git notes copy [-f] ( --stdin | <from-object> <to-object> ) git notes append [-F <file> | -m <msg> | (-c | -C) <object>] [<object>] git notes edit [<object>] git notes show [<object>] git notes merge [-v | -q] [-s <strategy> ] <notes_ref> git notes merge --commit [-v | -q] git notes merge --abort [-v | -q] git notes remove [--ignore-missing] [--stdin] [<object>...] git notes prune [-n | -v] git notes get-ref
  56. GIT-NOTES(1) Git Manual GIT-NOTES(1) NAME git-notes - Add or inspect

    object notes SYNOPSIS git notes [list [<object>]] git notes add [-f] [-F <file> | -m <msg> | (-c | -C) <object>] [<object>] git notes copy [-f] ( --stdin | <from-object> <to-object> ) git notes append [-F <file> | -m <msg> | (-c | -C) <object>] [<object>] git notes edit [<object>] git notes show [<object>] git notes merge [-v | -q] [-s <strategy> ] <notes_ref> git notes merge --commit [-v | -q] git notes merge --abort [-v | -q] git notes remove [--ignore-missing] [--stdin] [<object>...] git notes prune [-n | -v] git notes get-ref
  57. None
  58. Notes can be removed

  59. GIT-NOTES(1) Git Manual GIT-NOTES(1) NAME git-notes - Add or inspect

    object notes SYNOPSIS git notes [list [<object>]] git notes add [-f] [-F <file> | -m <msg> | (-c | -C) <object>] [<object>] git notes copy [-f] ( --stdin | <from-object> <to-object> ) git notes append [-F <file> | -m <msg> | (-c | -C) <object>] [<object>] git notes edit [<object>] git notes show [<object>] git notes merge [-v | -q] [-s <strategy> ] <notes_ref> git notes merge --commit [-v | -q] git notes merge --abort [-v | -q] git notes remove [--ignore-missing] [--stdin] [<object>...] git notes prune [-n | -v] git notes get-ref
  60. GIT-NOTES(1) Git Manual GIT-NOTES(1) NAME git-notes - Add or inspect

    object notes SYNOPSIS git notes [list [<object>]] git notes add [-f] [-F <file> | -m <msg> | (-c | -C) <object>] [<object>] git notes copy [-f] ( --stdin | <from-object> <to-object> ) git notes append [-F <file> | -m <msg> | (-c | -C) <object>] [<object>] git notes edit [<object>] git notes show [<object>] git notes merge [-v | -q] [-s <strategy> ] <notes_ref> git notes merge --commit [-v | -q] git notes merge --abort [-v | -q] git notes remove [--ignore-missing] [--stdin] [<object>...] git notes prune [-n | -v] git notes get-ref
  61. Resources

  62. http://progit.org/2010/08/25/notes.html

  63. https://github.com/blog/707-git-notes-display

  64. Useful?

  65. None
  66. GIT NOTES & GITHUB A Parallel Message Set