Metadata-Version: 2.4
Name: gibr
Version: 0.2.0
Summary: A Git CLI tool for intelligently creating branch names
Project-URL: Homepage, https://github.com/ytreister/gibr
Project-URL: Repository, https://github.com/ytreister/gibr
Project-URL: Issues, https://github.com/ytreister/gibr/issues
Author-email: Yair Treister <ytreister@gmail.com>
License-File: LICENSE
Keywords: automation,cli,git,github,gitlab,jira
Classifier: License :: Other/Proprietary License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Topic :: Software Development :: Version Control :: Git
Requires-Python: >=3.11
Requires-Dist: click==8.3.0
Requires-Dist: gitpython==3.1.43
Requires-Dist: jira>=3.9.2
Requires-Dist: pygithub==2.8.1
Requires-Dist: python-slugify>=8.0.4
Requires-Dist: tabulate>=0.9.0
Provides-Extra: dev
Requires-Dist: pytest-cov>=7.0.0; extra == 'dev'
Requires-Dist: pytest>=8.4.2; extra == 'dev'
Description-Content-Type: text/markdown

[![Tests](https://github.com/ytreister/gibr/actions/workflows/test.yml/badge.svg)](https://github.com/ytreister/gibr/actions/workflows/test.yml)
[![Coverage](https://codecov.io/gh/ytreister/gibr/branch/main/graph/badge.svg)](https://codecov.io/gh/ytreister/gibr)
[![PyPI version](https://img.shields.io/pypi/v/gibr.svg)](https://pypi.org/project/gibr/)
[![Python versions](https://img.shields.io/pypi/pyversions/gibr.svg)](https://pypi.org/project/gibr/)
[![License](https://img.shields.io/github/license/ytreister/gibr.svg)](https://github.com/ytreister/gibr/blob/main/LICENSE)
[![GitHub issues](https://img.shields.io/github/issues/ytreister/gibr.svg)](https://github.com/ytreister/gibr/issues)
[![GitHub pull requests](https://img.shields.io/github/issues-pr/ytreister/gibr.svg)](https://github.com/ytreister/gibr/pulls)

# gibr

A CLI that generates Git branch names from issue trackers (currently GitHub) and
creates + pushes the branch to `origin`.

## Quick start
### Installation
```bash
pip install gibr
```
### Usage (primary use case)
Issue #123 "Add support for OAuth2 / login (beta)"
```bash
$ gibr 123
Generating branch name for issue #123: Add support for OAuth2 / login (beta)
Branch name: issue/123/add-support-for-oauth2-login-beta
✅  Created branch 'issue/123/add-support-for-oauth2-login-beta' from main.
✅  Checked out branch: issue/123/add-support-for-oauth2-login-beta
✅  Pushed branch 'issue/123/add-support-for-oauth2-login-beta' to origin.
```
 
## Listing issues with `gibr issues`

You can list open issues from your configured tracker with:

```bash
gibr issues
```

This prints a short list of matching/open issues (id, title, type) so you can
pick which issue to use when creating a branch.

## Adding convenient Git aliases with `gibr alias`

`gibr` includes a built-in helper that writes git aliases into your global
`~/.gitconfig` for you. Run:

```bash
gibr alias
```

This adds aliases such as `git create` so that instead of using the gibr CLI directly, you can use an extended version of git:

```bash
git create 123
```

The above command is equivalent to using the CLI as follows: `gibr 123` or
`gibr create 123`.


### Flag order

Short rule:

```bash
# ✅ gibr CLI (flags before)
gibr --verbose create 123

# ✅ git alias (flags after)
git create 123 --verbose

# ❌ wrong: flags after gibr CLI
gibr create 123 --verbose 

# ❌ wrong: flags before the alias
git --verbose create 123
```

## Optional flags
- `--verbose` — enable debug-level logging for a command

## Configuration (`.gibrconfig`)

Example `.gibrconfig` (place in repo root or parent directory):

```ini
[DEFAULT]
branch_name_format = {issuetype}/{issue}-{title}

[issue-tracker]
name = github

[github]
repo = owner/repo
token = $GITHUB_TOKEN
```
### Jira configuration example
```ini
[DEFAULT]
branch_name_format = {issuetype}/{issue}-{title}

[issue-tracker]
name = jira

[jira]
url = https://project_name.atlassian.net
project_key=project_key
user=email@domain.com
token = $JIRA_TOKEN
```

Notes:
- Environment variables in config values are expanded.
- `branch_name_format` uses these placeholders: `{issuetype}`, `{issue}`, `{title}`.
