Skip to content

Instantly share code, notes, and snippets.

@romiras
Created November 28, 2024 22:06
Show Gist options
  • Select an option

  • Save romiras/df25ce1fbea182f1c368c2a42122bbf4 to your computer and use it in GitHub Desktop.

Select an option

Save romiras/df25ce1fbea182f1c368c2a42122bbf4 to your computer and use it in GitHub Desktop.
VCS: syncing strategy of latest updates from 'master' to 'myfeature' branch (git)

Task: sync latest updates from 'master' to 'myfeature' branch

git checkout myfeature
git merge -s ours master --no-commit

to take all changes from master into devel

git rebase master

Note that git cherry-pick creates a different commit. Subsequent merge of devel branch into master will be conflicted because of that. The solution is only suitable for 'rebase workflow'.

http://stackoverflow.com/a/15075677/2840001

We make it different, IMHO easier: in master we are working on the next major version.

Each larger feature gets its own branch (derived from master) and will be rebased (+ force pushed) on top of master regularly by the developer (rebasing only works fine if a single developer works on this feature). If the feature is finished, it will be freshly rebased onto master and then the master fast-forwarded to the latest feature commit. To avoid the rebasing/forced push one also can merge master changes regularly to the feature branch and if it's finished merge the feature branch into master (normal merge or squash merge). But IMHO this makes the feature branch less clear and makes it much more difficult to reorder/cleanup the commits.

If a new release is coming, we create a side-branch out of master, e.g. release-5 where only bugs get fixed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment