https://github.com/jojomatik/sync-branch
Sync one branch to another
https://github.com/jojomatik/sync-branch
branch fast-forward force-push git github-actions merge rebase sync
Last synced: 10 months ago
JSON representation
Sync one branch to another
- Host: GitHub
- URL: https://github.com/jojomatik/sync-branch
- Owner: jojomatik
- License: mit
- Created: 2022-03-07T15:58:45.000Z (over 4 years ago)
- Default Branch: beta
- Last Pushed: 2024-02-24T12:16:56.000Z (over 2 years ago)
- Last Synced: 2025-03-29T04:51:19.170Z (about 1 year ago)
- Topics: branch, fast-forward, force-push, git, github-actions, merge, rebase, sync
- Language: JavaScript
- Homepage:
- Size: 65.4 KB
- Stars: 2
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# sync-branch
[](https://github.com/jojomatik/sync-branch/releases) [](LICENSE) [](https://github.com/jojomatik/sync-branch/actions/workflows/publish.yml)
Sync one branch to another
## Usage
```yml
name: Update another branch on each release
release:
types:
- published
jobs:
sync_release_to_v1:
if: ${{ startsWith(github.ref, 'refs/tags/v1') && !contains(github.ref, 'beta') }}
name: Sync branch `main` to other branches (fast-forward enabled)
runs-on: ubuntu-latest
steps:
- name: Keep `v1` up to date with `main` (fast-forward enabled)
uses: jojomatik/sync-branch@v2
with:
# The branch to sync from
# Optional
# Default: github.ref_name
source: "main"
# The branch to sync to
# Optional
# Default: `beta`
target: "v1"
# The strategy to use, if fast-forward is not possible (merge, rebase, force,
# fail).
# Optional
# Default: `merge`
# Possible values:
# - `merge`: merge the source branch into the target branch
# - `rebase`: rebase the target branch onto the source branch
# - `force`: force push the source branch to the target branch (overrides
# any changes on the target branch)
# - `fail`: pushes the source branch to the target branch, fails if the
# target branch contains changes that are not present in the
# source branch
strategy: "merge"
# The changes to accept, if strategy `merge` leads to merge conflicts
# Optional
# Default: `target`
# Possible values:
# - `target`: forces conflicts to be auto-resolved cleanly by favoring
# the target version. All non-conflicting changes are reflected
# in the merge result.
# - `source`: forces conflicts to be auto-resolved cleanly by favoring
# the source version. All non-conflicting changes are reflected
# in the merge result.
# - `false`: `merge` fails if any merge conflicts occur.
resolve_conflicts: "target"
# The name to create merge commits with
# Required, if strategy `merge` is used
git_committer_name: ${{ secrets.BOT_GIT_NAME }}
# The email to create merge commits with
# Required, if strategy `merge` is used
git_committer_email: ${{ secrets.BOT_GIT_EMAIL }}
# The access token to push to the repository
# Optional
# Default: github.token
github_token: ${{ secrets.GH_TOKEN }}
```
## Licensing
This project is licensed under the MIT License (MIT). See also [`LICENSE`](LICENSE).