Commity is a script that print the commits from a git branch in a user-friendly way using Markdown format, inspired from default pull-requests templates in BitBucket.
You need Python 3.7 to execute this script.
Here is the command to install all necessary packages:
With pip:
pip install --no-cache-dir -r requirements.txt
With conda (and its environment):
conda install --name myenv -c conda-forge --file requirements.txt
To install this script, you first need to clone this project, and
then execute commity.py
.
To execute Commity, you might need to specify some arguments:
-r
or--repo
: The path to the git directory. By default, the current folder is taken.-b
or--branch
: The name of the branch where to get the commits. By default, the current branch is taken.-i
or--issue
: If given, the first line will contain all the issues that have been marked as "fixed" in the commits messages of the given branch.
Example:
python commity.py -r C:\Users\Foo\MyProject -b feat/gui-buttons -i
It is possible to run commity
from the given Dockerfile
.
To execute commity
using docker, please refer to the example below:
With Makefile:
cd path/to/commity
make docker-build
docker run -it -v "C:\Users\Foo\myproject:/myproject" cynnexis/commity run -r /myproject -b master --issue
Without Makefile:
cd path/to/commity
docker build -t cynnexis/commity .
docker run -it -v "C:\Users\Foo\myproject:/myproject" cynnexis/commity run -r /myproject -b master --issue
If your using bash, you can setup an alias to call commity
:
First, let's create a conda environment if you have not done iet yet:
cd path/to/commity
conda create --name commity python=3.7.6
conda install --name commity -c conda-forge --file requirements.txt
Then, activate the environment:
conda activate commity
Get the path to your Python environment:
which python
For this tutorial, let's assume the path is /home/user/anaconda3/envs/commity/bin/python
. Create an alias with the
following command:
echo alias commity="/home/user/anaconda3/envs/commity/bin/python /absolute/path/to/commity/commity.py" >> ~/.bash_aliases
And it's ready! To get all the commits messages of a local repository, go to your project folder, and execute the
commity
command such as:
commity -i
The command will assume the current working directory is the repository, and will analyze the current branch. The
fixed issues will be printed with the -i
option.
Contribution are not permitted yet, because this project is really simple and should not be a real problem. You noticed a bug in the script or in the source code? Feel free to post an issue about it.
- Valentin Berger (Cynnexis): developer
This project is under the GNU Affero General Public License v3.0. Please see the LICENSE.txt file for more detail (it's a really fascinating story written in there!)
- Git team ; what a flawless system they created!