Skip to content

rael/git-jira

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 

Repository files navigation

Script(s) to tie git and jira through Jira issues and git branches.
Copyright 2009 William S. Lear.  Distributed under terms of the GNU General
Public License (see LICENSE file).

CYGWIN NOTES:

There is an issue, logged in the github project, when running the
script on cygwin.  When I cloned and installed the file, there were
carriage return characters in the file, which seems to confuse bash
on cygwin for some reason.  To work around this, edit the file in 'binary'
mode (vim -b will do the trick), and then remove the carriage returns
(:%s/^M//), where ^M is achieved by hitting control-V then M.  I'm sure
there is a better way, but for now, just wanted to point out this
annoyance which I will try to track down and fix.

A few more cygwin gotchas:

  1) You need to install the util-linux package to provide the
     'getopts' command.

  2) You must specify your path to the jar file in a Windows-friendly
     way, e.g., your config file will need to have a value for the
     jar file that looks something like this (note double backslashes):

[jira]
	jar = C:\\cygwin\\home\\kkringle\\devel\\jira-cli-1.5.0\\release\\jira-cli-1.5.0.jar

INSTALL AND SETUP

Download the Jira CLI from Atlassian.  The git-jira script works with
Jira CLI versions 1.5.0 and later.  You can go to this link:

http://confluence.atlassian.com/display/JIRAEXT/JIRA+Command+Line+Interface

Download from the 'Download JAR' link.  Unpack the zip file in an install
directory.  Make sure you have a reasonably recent Java installed.

Copy the git-jira.sh script somewhere on your path.  To get started,
just type in 'git-jira.sh'.  The script will prompt you for the
location of the jira-cli jar file, the URL of the Jira server, your
Jira username, and Jira password.

To set these in your config file by hand:

% git config --global jira.jar <path_to_jar>
% git config --global jira.server <url for Jira server>
% git config --global jira.user <Your Jira user id>
% git config --global jira.password <Your Jira password>

Then, if you like, set default project, component, and issue type:

% git config --global jira.component Component1
% git config --global jira.project PROJ
% git config --global jira.issuetype Bug

The script will also ask if you want to set an alias for git-jira.sh
in your gitconfig file, so you can type 'git jira' instead of the
shell script itself.

OPENING AN ISSUE AND CREATING A "JIRA BRANCH"

Then you can open a Jira issue and create a git branch (a "jira branch")
based on the name of the issue:

% git jira open -s "Fix login permissions in user script"
git branch PROJ-31233 created

or, provide a suffix to help you remember what the branch is for:

% git jira open -s "Fix login permissions in user script" -x fix_login_perms
git branch PROJ-31233_fix_login_perms created

CLOSING AN ISSUE

When done working on the issue, you can resolve it with:

% git jira close PROJ-31233

DESCRIBING A JIRA BRANCH OR ISSUE

If you want details on the issue related to a Jira branch, you can use
jira describe:

% git branch
  master
  PROJ-207_my_stupid_proxy_fix
* PROJ-31233
% git jira describe
Data for issue: PROJ-31233

Issue key . . . . . . . . . . : PROJ-31233
Type  . . . . . . . . . . . . : Bug(1)
Status  . . . . . . . . . . . : Resolved(5)
Priority  . . . . . . . . . . : Major(3)
Assignee  . . . . . . . . . . : me
Reporter  . . . . . . . . . . : me
Created . . . . . . . . . . . : 11/11/09 8:51 PM
Updated . . . . . . . . . . . : 11/12/09 7:58 AM
Due date  . . . . . . . . . . :
Summary . . . . . . . . . . . : Weird bug in pre-order routine.
Description . . . . . . . . . :
Components  . . . . . . . . . :
Affects versions  . . . . . . :
Fix versions  . . . . . . . . :
Environment . . . . . . . . . :
Resolution  . . . . . . . . . : Fixed(1)
Votes . . . . . . . . . . . . : 0

or, describe another branch:

% git jira describe -i PROJ-207_my_stupid_proxy_fix

or, describe a jira ticket:

% git jira describe -i PROJ-207

About

Scripts to tie git and jira

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages