Skip to content

Instantly share code, notes, and snippets.

@clydet
Created July 6, 2023 08:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save clydet/9887c928fc51f0d947c578428a32c5a4 to your computer and use it in GitHub Desktop.
Save clydet/9887c928fc51f0d947c578428a32c5a4 to your computer and use it in GitHub Desktop.
A script to automate the merge of main branch changes to other branches
#!/bin/bash
GITHUB_DOMAIN='https://github.com'
GITHUB_ORG='ZagaUS'
TARGET_CODEBASE=$1
# clone given code base
function cloneCodebase() {
local codebase=$1
local github_url="${GITHUB_DOMAIN}/${GITHUB_ORG}/${codebase}"
git clone $github_url
}
# find all remote branches
function findRemoteBranches() {
}
# filter branches
# - what should filter criteria be?
function filterBranches() {
}
function backmerge() {
# iterate over filtered branches:
# - checkout branch
# - merge main into checked out branch
# - push branch to remote
}
cloneCodebase $TARGET_CODEBASE
findRemoteBranches
filterBranches
backmerge
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment