Wednesday, March 27, 2013

Problem with development-master git workflow

If you have development-master git workflow and you have hotfixes to master that were cherry-picked to development - then you need to merge all to master back - you will not have Fast-forward merge (so you loose commit/comment/tag history).

To keep history you need rollback to common point in time, and to merge from that point, and to preserve hot-fix history you need "merge -s ours":

# backup for master in special branch
git fetch -p
git checkout -b release_1_3
git push origin release_1_3
# reset master to common commit with development 
git checkout master 
git reset b666156da5d1756ddfe7123ed4f1688f9c69cf6a --hard
git push --force
git clean -fd
# fast forward merge with development
git merge development 
git push

#do fake merge merge to keep hotfixes in history of master "-s ours"
git merge -s ours release_1_3

#drop temporal branch
git branch -D release_1_3
git push origin :release_1_3

No comments:

Post a Comment