Create Git branches from Jira tickets
Project description
bfjira - Branch Management with JIRA Integration
bfjira (branch from Jira) is a command-line utility that simplifies the process of creating Git branches based on JIRA ticket information. It ensures that branch names are consistent and informative by incorporating the issue type and summary from the JIRA ticket.
Installation
The recommended way to install bfjira is via pip from PyPI:
pip install bfjira
Make sure you have pip installed and are using a virtual environment if necessary.
Usage
To use bfjira, you must have the following environment variables set:
JIRA_SERVER: Your JIRA server URL.JIRA_EMAIL: The email address associated with your JIRA account.JIRA_API_TOKEN: Your JIRA API token.
Instructions for creating a Jira API token can be found here
Optionally, you can set the JIRA_TICKET_PREFIX environment variable to use a default prefix other than "SRE" for ticket IDs that are entered without a prefix.
Basic Commands
-
Show version:
bfjira --version -
Show help message:
bfjira --help -
Create a branch for a JIRA ticket:
bfjira --ticket SRE-1234
If you only have the ticket number, bfjira will use the default prefix ("SRE" or whatever is set in
JIRA_TICKET_PREFIX):bfjira -t 1234
Advanced Options
-
Set a custom issue type for the branch:
bfjira -t 1234 --issue-type hotfix
-
Create a branch without setting the upstream:
bfjira -t 1234 --no-upstream
-
Increase output verbosity (useful for debugging):
bfjira -t 1234 --verbose
-
Optionally prevent transitioning the ticket to 'In Progress':
By default, the script transitions the specified JIRA ticket to 'In Progress'. If you wish to create a branch for the ticket without changing its status, use the
--no-progressflag. This is useful when you need to perform operations on the ticket without indicating that work has started.bfjira -t 1234 --no-progress
-
Handle uncommitted changes:
If
bfjiradetects uncommitted changes (including untracked files) in your repository, it will prompt you before proceeding. You can choose to have the script automatically stash these changes. The stash will be automatically popped after the branch is successfully created and the JIRA ticket is transitioned. If you choose not to stash, the script will exit.
Versioning
bfjira follows Semantic Versioning (SemVer) for its releases:
- MAJOR version (X.0.0) - Incompatible API changes
- MINOR version (0.X.0) - New features in a backward-compatible manner
- PATCH version (0.0.X) - Backward-compatible bug fixes
The versioning is automated through GitHub Actions, which:
- Detects the type of change (feature, fix, etc.) from commit messages
- Automatically increments the appropriate version number
- Creates a new release and publishes to PyPI
Troubleshooting
Common Issues
-
JIRA Authentication Errors
- Ensure your
JIRA_API_TOKENis valid and not expired - Verify your
JIRA_EMAILmatches the account associated with the API token - Check that your JIRA account has the necessary permissions
- Ensure your
-
Branch Creation Issues
- Make sure you're in a Git repository
- Verify you have write permissions to the repository
- Check that the branch name doesn't already exist
-
Version Mismatches
- If you encounter version-related issues, try updating to the latest version:
pip install --upgrade bfjira
- If you encounter version-related issues, try updating to the latest version:
Getting Help
If you encounter issues not covered here:
- Check the GitHub Issues for similar problems
- Enable verbose output with
--verboseflag for more detailed error messages - Open a new issue with detailed information about your problem
Development
Setup
bfjira uses Poetry for dependency management and packaging. To set up the development environment:
-
Install Poetry:
curl -sSL https://install.python-poetry.org | python3 -
-
Clone the repository:
git clone https://github.com/nwhobart/bfjira.git cd bfjira
-
Install dependencies:
poetry install -
Activate the virtual environment:
poetry shell
Running Tests
Run the test suite with:
poetry run pytest
Contributing
Contributions to bfjira are welcome! Please read the contributing guidelines before submitting pull requests.
License
bfjira is released under the GNU General Public License. See the LICENSE file for more details.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file bfjira-0.7.7.tar.gz.
File metadata
- Download URL: bfjira-0.7.7.tar.gz
- Upload date:
- Size: 17.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c6b42b23b4fdf6cad63dbfac7492342011407d0547c8d2a55835b1e3211b2ca1
|
|
| MD5 |
f0e80d409846b947b50c15af5350b298
|
|
| BLAKE2b-256 |
b34cd6af97ca7b77fd2b09cbd9ef4e087761edf60254f4014e5df91804c1cb62
|
Provenance
The following attestation bundles were made for bfjira-0.7.7.tar.gz:
Publisher:
release.yml on nwhobart/bfjira
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
bfjira-0.7.7.tar.gz -
Subject digest:
c6b42b23b4fdf6cad63dbfac7492342011407d0547c8d2a55835b1e3211b2ca1 - Sigstore transparency entry: 1296885911
- Sigstore integration time:
-
Permalink:
nwhobart/bfjira@66d19d450c3f40e42f653a2b581a7181ba3b681d -
Branch / Tag:
refs/heads/main - Owner: https://github.com/nwhobart
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@66d19d450c3f40e42f653a2b581a7181ba3b681d -
Trigger Event:
pull_request
-
Statement type:
File details
Details for the file bfjira-0.7.7-py3-none-any.whl.
File metadata
- Download URL: bfjira-0.7.7-py3-none-any.whl
- Upload date:
- Size: 19.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c70d75dd8dcaee8e315552d9df7ab5db712675dc3de4e84b55ed746a80eae587
|
|
| MD5 |
598c7a091364f0ace952d7423f01505d
|
|
| BLAKE2b-256 |
6624e7711bd35a2bc07051c1244356c2a51ad6cb0b80f92979b16c44328dfe39
|
Provenance
The following attestation bundles were made for bfjira-0.7.7-py3-none-any.whl:
Publisher:
release.yml on nwhobart/bfjira
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
bfjira-0.7.7-py3-none-any.whl -
Subject digest:
c70d75dd8dcaee8e315552d9df7ab5db712675dc3de4e84b55ed746a80eae587 - Sigstore transparency entry: 1296886022
- Sigstore integration time:
-
Permalink:
nwhobart/bfjira@66d19d450c3f40e42f653a2b581a7181ba3b681d -
Branch / Tag:
refs/heads/main - Owner: https://github.com/nwhobart
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@66d19d450c3f40e42f653a2b581a7181ba3b681d -
Trigger Event:
pull_request
-
Statement type: