Skip to content

Instantly share code, notes, and snippets.

@lktslionel
Last active March 29, 2021 22:04
Show Gist options
  • Save lktslionel/be548a24f7324cbe39bb16e03531b122 to your computer and use it in GitHub Desktop.
Save lktslionel/be548a24f7324cbe39bb16e03531b122 to your computer and use it in GitHub Desktop.
Git workflow playground

Git workflow playground

# Brnach courante
CURR_BRANCH=$(git rev-parse --abbrev-ref HEAD)

# Go to develop
git checkout  develop

US_JIRAS=(
    4
    6
)

# Ajouter des elements dans le tableau 
US_JIRAS+=(23)

# Préparer les filtres
FILTER_BY_US="$(echo ${US_JIRAS[@]} | tr ' ' '|')"


COMMIT_TO_MERGE=$(git log --oneline  | grep "Merge branch" | grep -E "feat/($FILTER_BY_US)" | awk '{ print $1}')


# Go to release branch
DEST_BRANCH="REL/1.0.x"
git checkout $DEST_BRANCH

# Cherry pick des US_JIRAS
git cherry-pick $COMMIT_TO_MERGE

# Phase de release 
echo "1.0.0" > VERSION
git add . && git commit -m "New release: 1.0.0"
git tag 1.0.0 # Apres la PR sur master

# Suppresion des tag de pre-release si besoin  (optionel)
git tag -d 1.0.0-rc1 -d 1.0.0-rc2

# Les US embarquées entre 2 versions
git log  --oneline --graph 1.0.0...1.0.0-rc1 | grep "Merge branch"  | awk '{ print $5 }'

# version avancée
merge_feat.sh --branch <DEST_BRANCH> --jira-user-stories 1,2,3,4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment