==================
git-build-branch
==================
.. image:: https://img.shields.io/pypi/v/git-build-branch.svg
:target: https://pypi.python.org/pypi/git-build-branch
Utility tool for building Git branches by merging multiple other branches together.
* Free software: BSD license
For guidelines on contributing to the project please read the CONTRIBUTING_ documentation.
.. _CONTRIBUTING: CONTRIBUTING.rst
Documentation
-------------
In some cases it may be desirable to have full control over what code is deployed. This can
be accomplished by creating a YAML configuration file to describe what should be included in your branch.
The format of the file is as follows:
.. code-block:: yaml
trunk: master
name: autostaging # name of the branch to build
branches: # list of branches to merge into final branch
- feature1
- feature2
- forkowner:feature3 # branch from fork of repository
submodules:
submodules/module1:
branches:
- feature1
- forkowner:feature2 # branch from fork of repository
submodules/module2:
trunk: develop
branches:
- feature2
To add some safety around this file you should use the ``safe-commit-files`` utility:
.. code-block:: shell
safe-commit-files --push /path/to/branch_config.yml
Building the branch
~~~~~~~~~~~~~~~~~~~
This configuration file can be used to build a deploy branch:
.. code-block:: bash
git checkout master
git-build-branch path/to/branch_config.yml
Conflict Resolution
~~~~~~~~~~~~~~~~~~~
First, determine where the conflict lies.
a). branch ``foo`` conflicts with ``master``
.. code-block:: shell
git checkout -b foo origin/foo
git pull origin master
# try to resolve conflict
git push origin foo
b). branch ``foo`` conflicts with branch ``bar``
You can't just merge foo into bar or vice versa, otherwise the PR
for foo will contain commits from bar. Instead make a third,
conflict-resolution branch:
.. code-block:: shell
git checkout -b foo+bar --no-track origin/foo
git pull origin bar
# try to resolve conflict
git push origin foo+bar
Now add the branch ``foo+bar`` to ``branch_config.yml`` and move branches foo and
bar to right below it.
Later on branch B gets merged into master and removed from ``branch_config.yml``.
Perhaps the person who removes it also notices the A+B and does the
following. Otherwise anyone who comes along and sees A+B but not both
branches can feel free to assume the following need to be done.
* Merge A+B into A. Since B is now gone, you want to merge the
resolution into A, otherwise A will conflict with master.
* Remove A+B from ``branch_config.yml``. It's no longer necessary since it's
now a subset of A.
If you are unsure of how to resolve a conflict, notify the branch owner.
Raw data
{
"_id": null,
"home_page": "https://github.com/dimagi/git-build-branch",
"name": "git-build-branch",
"maintainer": null,
"docs_url": null,
"requires_python": null,
"maintainer_email": null,
"keywords": "git-build-branch",
"author": "Dimagi",
"author_email": "dev@dimagi.com",
"download_url": "https://files.pythonhosted.org/packages/f4/82/bdad4c251f10c8236d9d51be5c4e14f93d7936d37246d8add8987bba21b6/git_build_branch-0.1.18.tar.gz",
"platform": null,
"description": "==================\ngit-build-branch\n==================\n\n\n.. image:: https://img.shields.io/pypi/v/git-build-branch.svg\n :target: https://pypi.python.org/pypi/git-build-branch\n\n\nUtility tool for building Git branches by merging multiple other branches together.\n\n\n* Free software: BSD license\n\nFor guidelines on contributing to the project please read the CONTRIBUTING_ documentation.\n\n.. _CONTRIBUTING: CONTRIBUTING.rst\n\n\nDocumentation\n-------------\nIn some cases it may be desirable to have full control over what code is deployed. This can\nbe accomplished by creating a YAML configuration file to describe what should be included in your branch.\n\nThe format of the file is as follows:\n\n.. code-block:: yaml\n\n trunk: master\n name: autostaging # name of the branch to build\n branches: # list of branches to merge into final branch\n - feature1\n - feature2\n - forkowner:feature3 # branch from fork of repository\n submodules:\n submodules/module1:\n branches:\n - feature1\n - forkowner:feature2 # branch from fork of repository\n submodules/module2:\n trunk: develop\n branches:\n - feature2\n\nTo add some safety around this file you should use the ``safe-commit-files`` utility:\n\n.. code-block:: shell\n\n safe-commit-files --push /path/to/branch_config.yml\n\nBuilding the branch\n~~~~~~~~~~~~~~~~~~~\nThis configuration file can be used to build a deploy branch:\n\n.. code-block:: bash\n\n git checkout master\n git-build-branch path/to/branch_config.yml\n\nConflict Resolution\n~~~~~~~~~~~~~~~~~~~\n\nFirst, determine where the conflict lies.\n\na). branch ``foo`` conflicts with ``master``\n\n.. code-block:: shell\n\n git checkout -b foo origin/foo\n git pull origin master\n\n # try to resolve conflict\n\n git push origin foo\n\nb). branch ``foo`` conflicts with branch ``bar``\n\nYou can't just merge foo into bar or vice versa, otherwise the PR\nfor foo will contain commits from bar. Instead make a third,\nconflict-resolution branch:\n\n.. code-block:: shell\n\n git checkout -b foo+bar --no-track origin/foo\n git pull origin bar\n\n # try to resolve conflict\n\n git push origin foo+bar\n\nNow add the branch ``foo+bar`` to ``branch_config.yml`` and move branches foo and\nbar to right below it.\n\nLater on branch B gets merged into master and removed from ``branch_config.yml``.\n\nPerhaps the person who removes it also notices the A+B and does the\nfollowing. Otherwise anyone who comes along and sees A+B but not both\nbranches can feel free to assume the following need to be done.\n\n* Merge A+B into A. Since B is now gone, you want to merge the\n resolution into A, otherwise A will conflict with master.\n\n* Remove A+B from ``branch_config.yml``. It's no longer necessary since it's\n now a subset of A.\n\nIf you are unsure of how to resolve a conflict, notify the branch owner.\n\n",
"bugtrack_url": null,
"license": "BSD license",
"summary": "Utility tool for building Git branches my merging multiple other branches together.",
"version": "0.1.18",
"project_urls": {
"Homepage": "https://github.com/dimagi/git-build-branch"
},
"split_keywords": [
"git-build-branch"
],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "b43d16855a5f42d6fde7d49dc66b1d52cc9e5bff0212315764fba91c3321afa6",
"md5": "deed875b67b8076ec23c18888f91ad6a",
"sha256": "56008ebd4bcf87be068360cabeea92a6f81954681de5b258247672b6d964c989"
},
"downloads": -1,
"filename": "git_build_branch-0.1.18-py2.py3-none-any.whl",
"has_sig": false,
"md5_digest": "deed875b67b8076ec23c18888f91ad6a",
"packagetype": "bdist_wheel",
"python_version": "py2.py3",
"requires_python": null,
"size": 13191,
"upload_time": "2025-07-09T19:29:45",
"upload_time_iso_8601": "2025-07-09T19:29:45.455506Z",
"url": "https://files.pythonhosted.org/packages/b4/3d/16855a5f42d6fde7d49dc66b1d52cc9e5bff0212315764fba91c3321afa6/git_build_branch-0.1.18-py2.py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "f482bdad4c251f10c8236d9d51be5c4e14f93d7936d37246d8add8987bba21b6",
"md5": "2a0a1551df00883a3c7e8d2c1ad1fdcd",
"sha256": "6310a52b07c757f89094b7ea2832d0fb08914f01a4cd60417421ac98967146ae"
},
"downloads": -1,
"filename": "git_build_branch-0.1.18.tar.gz",
"has_sig": false,
"md5_digest": "2a0a1551df00883a3c7e8d2c1ad1fdcd",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 13366,
"upload_time": "2025-07-09T19:29:46",
"upload_time_iso_8601": "2025-07-09T19:29:46.252719Z",
"url": "https://files.pythonhosted.org/packages/f4/82/bdad4c251f10c8236d9d51be5c4e14f93d7936d37246d8add8987bba21b6/git_build_branch-0.1.18.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-07-09 19:29:46",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "dimagi",
"github_project": "git-build-branch",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "git-build-branch"
}