<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://docs.uabgrid.uab.edu/w/index.php?action=history&amp;feed=atom&amp;title=GitHooks</id>
	<title>GitHooks - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://docs.uabgrid.uab.edu/w/index.php?action=history&amp;feed=atom&amp;title=GitHooks"/>
	<link rel="alternate" type="text/html" href="https://docs.uabgrid.uab.edu/w/index.php?title=GitHooks&amp;action=history"/>
	<updated>2026-05-27T04:36:55Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.38.2</generator>
	<entry>
		<id>https://docs.uabgrid.uab.edu/w/index.php?title=GitHooks&amp;diff=3534&amp;oldid=prev</id>
		<title>Pavgi@uab.edu: /* Prepare commit message */</title>
		<link rel="alternate" type="text/html" href="https://docs.uabgrid.uab.edu/w/index.php?title=GitHooks&amp;diff=3534&amp;oldid=prev"/>
		<updated>2012-01-10T21:04:30Z</updated>

		<summary type="html">&lt;p&gt;&lt;span dir=&quot;auto&quot;&gt;&lt;span class=&quot;autocomment&quot;&gt;Prepare commit message&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 21:04, 10 January 2012&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l2&quot;&gt;Line 2:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 2:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;=== Prepare commit message ===&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;=== Prepare commit message ===&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;In most projects a version control system (Git) is integrated with a project management software (trac). Most of the development activities or issues are tracked using 'ticket' system of project management software like trac. Often developers use version control system's 'branches' to isolate their development work according to issues or tickets and hence in such ticket-driven development &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;branche &lt;/del&gt;names tend to be based on ticket number or description. Also, it is a good practice to reference these ticket numbers  in version control system's history (commit messages) so that tickets and corresponding development activity (code changes) can be cross-referenced.  &lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;In most projects a version control system (Git) is integrated with a project management software (trac). Most of the development activities or issues are tracked using 'ticket' system of project management software like trac. Often developers use version control system's 'branches' to isolate their development work according to issues or tickets and hence in such ticket-driven development &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;branch &lt;/ins&gt;names tend to be based on ticket number or description. Also, it is a good practice to reference these ticket numbers  in version control system's history (commit messages) so that tickets and corresponding development activity (code changes) can be cross-referenced.  &lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Following is an example commit hook to help adding current working branch name (assumed to be ticket number) to a commit message. It will add a commented-out line in addition to default pre-populated commented-out lines.   &lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Following is an example &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;of prepare-&lt;/ins&gt;commit&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;-message &lt;/ins&gt;hook to help adding current working branch name (assumed to be ticket number) to a commit message. It will add a commented-out line in addition to default pre-populated commented-out lines.   &lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;   msg=`git branch | sed -e '/^[^*]/d' -e 's/* \(.*\)/# Commit for [galaxy:ticket:\1]/'`&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;   msg=`git branch | sed -e '/^[^*]/d' -e 's/* \(.*\)/# Commit for [galaxy:ticket:\1]/'`&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Pavgi@uab.edu</name></author>
	</entry>
	<entry>
		<id>https://docs.uabgrid.uab.edu/w/index.php?title=GitHooks&amp;diff=3533&amp;oldid=prev</id>
		<title>Pavgi@uab.edu at 20:58, 10 January 2012</title>
		<link rel="alternate" type="text/html" href="https://docs.uabgrid.uab.edu/w/index.php?title=GitHooks&amp;diff=3533&amp;oldid=prev"/>
		<updated>2012-01-10T20:58:46Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 20:58, 10 January 2012&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l2&quot;&gt;Line 2:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 2:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;=== Prepare commit message ===&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;=== Prepare commit message ===&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;In most projects a version control system (Git) is integrated with a project management software (trac). &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;It is a good practice to create &lt;/del&gt;project management &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;ticket for issue tracking and also reference this ticket number in your &lt;/del&gt;version control system's &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;history (commit messages). Also, many developers find it easier &lt;/del&gt;to isolate their development work &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;using 'branches'. If you are following &lt;/del&gt;such ticket-driven development &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;and want &lt;/del&gt;to &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;include &lt;/del&gt;ticket&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;-&lt;/del&gt;number in &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;every &lt;/del&gt;commit &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;message then you may find following commit hook useful&lt;/del&gt;. Following example &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;adds reference &lt;/del&gt;to &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;a ticket number based on your &lt;/del&gt;current working branch.   &lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;In most projects a version control system (Git) is integrated with a project management software (trac). &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;Most of the development activities or issues are tracked using 'ticket' system of &lt;/ins&gt;project management &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;software like trac. Often developers use &lt;/ins&gt;version control system's &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;'branches' &lt;/ins&gt;to isolate their development work &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;according to issues or tickets and hence in &lt;/ins&gt;such ticket-driven development &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;branche names tend &lt;/ins&gt;to &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;be based on &lt;/ins&gt;ticket number &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;or description. Also, it is a good practice to reference these ticket numbers  &lt;/ins&gt;in &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;version control system's history (&lt;/ins&gt;commit &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;messages) so that tickets and corresponding development activity (code changes) can be cross-referenced&lt;/ins&gt;.  &lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Following &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;is an &lt;/ins&gt;example &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;commit hook &lt;/ins&gt;to &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;help adding &lt;/ins&gt;current working branch &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;name (assumed to be ticket number) to a commit message. It will add a commented-out line in addition to default pre-populated commented-out lines&lt;/ins&gt;.   &lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;   msg=`git branch | sed -e '/^[^*]/d' -e 's/* \(.*\)/# Commit for [galaxy:ticket:\1]/'`&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;   msg=`git branch | sed -e '/^[^*]/d' -e 's/* \(.*\)/# Commit for [galaxy:ticket:\1]/'`&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;   sed -i -e &amp;quot;1i $msg&amp;quot; &amp;quot;$1&amp;quot;&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;   sed -i -e &amp;quot;1i $msg&amp;quot; &amp;quot;$1&amp;quot;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;The above example &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;works &lt;/del&gt;uses GNU sed and hence doesn't work on the Mac OS which uses BSD sed. Following Ruby one-liner example works on both Linux and Mac OS systems.  &lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;The above example uses GNU sed and hence doesn't work on the Mac OS which uses BSD sed. Following Ruby one-liner example works on both Linux and Mac OS systems.  &lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;   ruby  -i -pe 'puts `git branch`.split(/\n/).select {|e| e =~ /\*.*/}.to_s.sub(/\* /,&amp;quot;# Commit for [galaxy:ticket:&amp;quot;).concat(&amp;quot;]&amp;quot;) if $.==1' &amp;quot;$1&amp;quot;&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;   ruby  -i -pe 'puts `git branch`.split(/\n/).select {|e| e =~ /\*.*/}.to_s.sub(/\* /,&amp;quot;# Commit for [galaxy:ticket:&amp;quot;).concat(&amp;quot;]&amp;quot;) if $.==1' &amp;quot;$1&amp;quot;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;Modify &lt;/del&gt;above one-liners according to your ticket-branch naming convention.&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;You may need to modify &lt;/ins&gt;above one-liners according to your ticket-branch naming convention &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;and other requirements&lt;/ins&gt;.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Pavgi@uab.edu</name></author>
	</entry>
	<entry>
		<id>https://docs.uabgrid.uab.edu/w/index.php?title=GitHooks&amp;diff=3532&amp;oldid=prev</id>
		<title>Pavgi@uab.edu: added notes on preparing commit message based on current working branch (ticket number)</title>
		<link rel="alternate" type="text/html" href="https://docs.uabgrid.uab.edu/w/index.php?title=GitHooks&amp;diff=3532&amp;oldid=prev"/>
		<updated>2012-01-10T16:01:14Z</updated>

		<summary type="html">&lt;p&gt;added notes on preparing commit message based on current working branch (ticket number)&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;Git hooks are custom scripts that trigger upon certain git action/command.  The [http://progit.org/book/ch7-3.html ProGit] book has explained Git hooks mechanism in detail so I recommend reading it before proceeding with following sections. &lt;br /&gt;
&lt;br /&gt;
=== Prepare commit message ===&lt;br /&gt;
In most projects a version control system (Git) is integrated with a project management software (trac). It is a good practice to create project management ticket for issue tracking and also reference this ticket number in your version control system's history (commit messages). Also, many developers find it easier to isolate their development work using 'branches'. If you are following such ticket-driven development and want to include ticket-number in every commit message then you may find following commit hook useful. Following example adds reference to a ticket number based on your current working branch.  &lt;br /&gt;
&lt;br /&gt;
  msg=`git branch | sed -e '/^[^*]/d' -e 's/* \(.*\)/# Commit for [galaxy:ticket:\1]/'`&lt;br /&gt;
  sed -i -e &amp;quot;1i $msg&amp;quot; &amp;quot;$1&amp;quot;&lt;br /&gt;
&lt;br /&gt;
The above example works uses GNU sed and hence doesn't work on the Mac OS which uses BSD sed. Following Ruby one-liner example works on both Linux and Mac OS systems. &lt;br /&gt;
  ruby  -i -pe 'puts `git branch`.split(/\n/).select {|e| e =~ /\*.*/}.to_s.sub(/\* /,&amp;quot;# Commit for [galaxy:ticket:&amp;quot;).concat(&amp;quot;]&amp;quot;) if $.==1' &amp;quot;$1&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Modify above one-liners according to your ticket-branch naming convention.&lt;/div&gt;</summary>
		<author><name>Pavgi@uab.edu</name></author>
	</entry>
</feed>