Package: git-mr-linear
git-mr-linearA command line utility to list and merge GitLab pull requests while maintaining linear history.To maintain linear history, a pull request branch is rebased on top of its base, before merging. This creates a linear history like in this diagram:Further Reading & ContextA Tidy Linear Git HistoryAvoid Messy Git HistoryA Git Workflow for Agile TeamsGit Rebase TutorialUsageInstallingPython3.6 or above is required. You can install this package by running the following command:pip3 install git-mr-linearTo upgrade to the latest version:pip3 install --upgrade git-mr-linearHow To UseGet help:git mr -hThe first time you run this script, you will be asked to authenticate with Gitlab.List CommandList all open pull requests:git mr list, or list only yours withgit mr list --mine#  Title                                                         Branch
----  ------------------------------------------------------------  -------------------------------
5811  Fix various bugs with video player                            fix/kevin-video-player-bugs
5812  Fix highlight being stuck when gallery frame is deactivated   fix/kevin-highlightable-view
...Merge CommandMerge a pull request:git mr merge NUMBERSquash CommandSquash a pull request:git mr squash NUMBERThe squash command collapses all commits from the pull branch into a single commit and puts that commit straight onto the base branch without doing an explicit merge.Here's what the history looks like when you usesquashvsmerge.Repo configurationAdd a.linmergercconfig file to the repo root directory to customize behaviour to your teams preference.Below are all the options[merge]# Commit message format vars: TITLE, NUMBER, AUTHOR_NAME, AUTHOR_USERNAMEmerge_msg_format=Merge: {TITLE} (#{NUMBER})# Enable single-commit pulls to be squashed instead of merging, even when explicitly using the merge commandalways_squash_single_commit_pulls=True[squash]squash_msg_format={TITLE} (#{NUMBER})# Enable usage of the `git mr squash` commandsquash_cmd_enabled=TrueTroubleshootingYou see "git: mr is not a git command"Runsudo pip3 install git-mr-linearand see if you receive a yellow warning message indicating..../Library/Caches/pipis not writable by the current user. This indicates the installation has not completed successfully due to incorrect write permissionsRunsudo -H pip3 install git-mr-linearIf the error still persists, make sure you have write access to~/Library/Python/3.X/bin. Runsudo -H pip3 install git-mr-linearagain if you changed any write permissionsDevelopmentThis section explains how to setup the dev environment and update the packageEnvironment setuppython3 -m pip install virtualenv
python3 virtualenv venv
source venv/bin/activate
pip install -r requirements.txtRunning LocallyWith the environment setup through the previous step, you can rungit mrusing your local code by running thegit-mr.pyscript in the root directory of this repo.python3 ~/path/to/your/local/checkout/git-mr.pyUpdating the packageMake sure to bump the version number with updates according toPEP 440Publish and Install from TestPyPiBefore publishing for real, you can test a package by publishing it to TestPyPiPublishing:source venv/bin/activate
rm -rf dist
rm -rf build
python -m build
twine upload --repository testpypi dist/*Installing:python3 -m pip install --index-url https://test.pypi.org/simple/ git-mr-linearPublishsource venv/bin/activate
rm -rf dist
rm -rf build
python -m build
twine upload dist/*