Git Notes and GitHub

Post on 20-Feb-2017

1.019 views 5 download

Transcript of Git Notes and GitHub

GIT NOTES & GITHUB

GIT NOTES & GITHUBA Parallel Message Set

Notes

• Object pointing to a commit

• Supplemental to commit messages

• Namespaced for grouping of notes

• Object pointing to a commit

• Supplemental to commit messages

• Namespaced for grouping of notes

• Object pointing to a commit

• Supplemental to commit messages

• Namespaced for grouping of notes

— Git notes man page

A typical use of notes is to supplement a commit message without changing the commit itself.

The Basics

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

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

Create a note

$ git notes add -m”<SOMENOTEMESSAGE>”

Video

Examine the directory structure

$ tree .git/refs/notes

Video

Displaying notes

$ git notes show <COMMIT>

Video

$ git log <COMMIT>

Video

Namespacing

Default namespace is commits

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

Video

Viewing a different namespace

$ git notes --ref jenkins show <COMMIT>

Video

$ git log --show-notes=jenkins

Video

$ git log --show-notes=*

Video

Pushing

Notes don’t push by default

git push origin refs/notes/commits

// orgit push origin refs/notes/jenkins

// orgit push origin refs/notes/*

Video

$ git config --global alias.pushnotes "\!sh -c 'git push \$1 refs/notes/*' -"

$ git pushnotes origin

Fetching

Notes don’t fetch by default

$ 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/*

Video

$ git config --global alias.fetchnotes\ "\!sh -c 'git fetch \$1 refs/notes/*:refs/notes/*' -"

$ 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/*

GitHub

Notes are shown with commits

Video

More?

Notes can be appended

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

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

Notes can be merged

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

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

Notes can be removed

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

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

Resources

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

Useful?

GIT NOTES & GITHUBA Parallel Message Set