Skip to content

Instantly share code, notes, and snippets.

@Maks3w
Forked from weierophinney/zf2-workflow.txt
Created September 18, 2012 19:25
Show Gist options
  • Save Maks3w/3745246 to your computer and use it in GitHub Desktop.
Save Maks3w/3745246 to your computer and use it in GitHub Desktop.
proposed workflow
REM Use hotfix.bat <PR Number> <BRANCH name without hotfix preffix>
set PR=%1
set BRANCH=hotfix/%2
call git checkout master
call git pull upstream master
call git checkout -b %BRANCH% master
call git pull upstream refs/pull/%PR%/head
echo "Review the PR and fix it if needed"
pause
call git checkout master
call git merge --no-ff -m "Merge pull request #%PR% branch '%BRANCH%'" %BRANCH%
call git checkout develop
call git pull upstream develop
call git merge --no-ff -m "Merge pull request #%PR% branch '%BRANCH%'" %BRANCH%
echo "Push to your fork"
pause
call git push origin develop
call git checkout master
call git push origin master
echo "Push to main repo"
pause
call git push upstream master
call git checkout develop
call git push upstream develop
#!/bin/sh
# Use hotfix.sh <PR Number> <BRANCH name without hotfix preffix> <additional commit message>
PR=$1
BRANCH=hotfix/$2
git checkout master
git pull upstream master
git checkout -b $BRANCH master
git pull upstream refs/pull/$PR/head
read -p "Review the PR and fix it if needed"
git checkout master
git merge --no-ff -m "Merge pull request #$PR branch '$BRANCH' $3" $BRANCH
git checkout develop
git pull upstream develop
git merge --no-ff -m "Forward port #$PR" $BRANCH
read -p "Push to your fork"
git push origin develop
git checkout master
git push origin master
read -p "Push to main repo"
git push upstream master
git checkout develop
git push upstream develop
We rename "master" to "develop"
We rename "release" to "master"
Thus "master" stays the default branch, which means most PRs will be made
against it.
Bugfixes are merged to:
- master
- develop
Features are merged to:
- develop
When develop looks like the next minor or major version:
- create new release branch, release/X.Y.0, from develop branch
- once stable, merge release/X.Y.0 to master, and delete release/X.Y.0
- bugfixe branches merged to release/X.Y.0 are also merged to develop
To merge a bugfix:
PR=<PR NUMBER>
BRANCH=hotfix/someone
git checkout -b $BRANCH master
git pull upstream refs/pull/$PR/head
verify...
git checkout master
git merge --no-ff -m "Merge pull request #$PR branch '$BRANCH'" $BRANCH
git checkout develop
git merge --no-ff -m "Merge pull request #$PR branch '$BRANCH'" $BRANCH
To merge a feature:
git checkout -b feature/somename develop
git pull upstream refs/pull/<PR NUMBER>/head
verify ....
git checkout develop
git merge --no-ff -m "Merge pull request #<PR NUMBER> branch 'feature/somename '" feature/somename
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment