TensorBay supports squashing and merging between different branches.
Before :func:`~tensorbay.client.version.VersionControlClient.squash_and_merge`, a dataset client instance with commits on different branches is needed. See more details in :ref:`features/version_control/draft_and_commit:Draft and Commit`.
.. literalinclude:: ../../../../docs/code/squash_and_merge.py :language: python :start-after: """Authorize a Dataset Client Instance""" :end-before: """"""
TensorBay SDK allows :func:`~tensorbay.client.version.VersionControlClient.squash_and_merge` by giving the target_branch_name
:
.. literalinclude:: ../../../../docs/code/squash_and_merge.py :language: python :start-after: """Squash and Merge""" :end-before: """"""
Or checkout
to the target_branch first. In this case, the current branch is main
, so we can do squash_and_merge operation directly.
.. literalinclude:: ../../../../docs/code/squash_and_merge.py :language: python :start-after: """Checkout First""" :end-before: """"""
Note
There are three strategies for handling the branch conflict:
- "abort": abort the opetation;
- "override": the squashed branch will override the target branch;
- "skip": keep the origin branch.