Specifying work items in Git Notes
You can create a Git notes object for a commit and mention a work item number as part of the Git notes text. If a notes object exists for a commit, you can use the append or edit subcommand to update the note.
Creating links
The following example illustrates how to add/create a Git notes object to a commit.
git fetch origin +refs/notes/commits:refs/notes/commits
#Append the given text to the notes object of the given commit. If no notes object exists, append creates one.
git notes append -m "rtc.wi:123" commit-sha1
#Push the Notes Ref
git push origin refs/notes/commits:refs/notes/commits
The following example illustrates how to edit an existing notes object.
git fetch origin +refs/notes/commits:refs/notes/commits
#To edit, you can use the following command, which opens an editor, where in you can add a line "rtc.wi:123"
git notes edit commit-sha1
#Push the Notes Ref
git push origin refs/notes/commits:refs/notes/commits
Removing links
The following example illustrates how to delete and push a Git notes object, which removes the commit link from all work items that are mentioned in the Git notes text.
git fetch origin +refs/notes/commits:refs/notes/commits
#Delete the notes object itself.
git notes remove commit-sha1
#Push the Notes Ref
git push origin refs/notes/commits:refs/notes/commits
The following example illustrates how to remove a work item number from Git notes text, which unlinks the notes object with a specific work item only.
git fetch origin +refs/notes/commits:refs/notes/commits
#To edit, you can use the following command, which opens an editor, where in you can remove the desired work item reference.
git notes edit commit-sha1
#Push the Notes Ref
git push origin refs/notes/commits:refs/notes/commits
Modifying links
The following example illustrates how to add or remove a work item number from Git notes text then push the notes object.
git fetch origin +refs/notes/commits:refs/notes/commits
#To edit, you can use the following command, which opens an editor, where in you can change the desired work item number.
git notes edit commit-sha1
#Push the Notes Ref
git push origin refs/notes/commits:refs/notes/commits
Process Governance for Notes
You can control who can push Note objects (allow Notes changes to be accepted only from certain roles).
To avoid accidental unlinking of commit links with work items, you can limit the roles that can change notes by creating a Ref Mapping for the Notes ref (refs/notes/commits). For more information, see Understanding the Git Integration features in Rational Team Concert 5.0