0

I have a system setup in a private git, in which there are 3 main branches. (development, beta, release) Commits are made to development (which is my master branch) but here I am stuck. I'd like to push specific commits from development to beta, then those commits from beta to release. This way I can open a branch and compile a developmental build, or open the beta branch and compile a version sent to beta testers, or open the release branch and compile a stable, public version. It isnt just me committing to this private repo, so some more commits may be made that arent ready for the beta branch while other commits are ready.

I hope this made sense, but if you have a suggestion for a better system I could use instead of this, I'd love to hear it!

TL;DR: Bad workflow, tried to make it work, got new workflow instead.

Yudowat
  • 15
  • 3
  • 1
    You seem very confused about basic workflow in version control. Typically you would just merge from one branch to the next, but it isn't clear what you are really asking here. – Tim Biegeleisen Mar 25 '17 at 11:45
  • 1
    Sounds like simple `checkout` -> `commit` -> `merge` workflow – Peter Chaula Mar 25 '17 at 11:53
  • @TimBiegeleisen sorry I wasn't clear enough, but reading my reply to Guido Garcia may clarify a little more, as he solved my problem. – Yudowat Mar 25 '17 at 12:19

2 Answers2

1

You can use git cherry-pick to apply some commits in "development" to one of your branches ("beta", "release"). See also this question.

That solves your problem, but you should think about your whole git workflow. You usually want to push commits to your "development" branch and then merge that branch to "beta" (the next branch). View cherry-pick as an exception, not the rule.

Guido
  • 46,642
  • 28
  • 120
  • 174
  • 1
    Or `rebase onto` might be an option. – Tim Biegeleisen Mar 25 '17 at 11:51
  • I wasn't sure if cherry-pick would be what i'm looking for with some commit's over taking each other multiple times until they reach the 'release' branch, but after seeing your answer, i created a quick testing repo and everything works fine so far. Thank you! – Yudowat Mar 25 '17 at 12:18
  • 2
    In my experience, cherry-pick is something which is only occasionally used. If you find yourself using cherry-pick often, in every sprint, then it might be a sign that your branch workflow has a problem or is poorly designed. – Tim Biegeleisen Mar 25 '17 at 12:23
  • @TimBiegeleisen It seems like i'll be cherry picking a lot with this setup. Is there a workflow that would achieve something similar to this: `This way I can open the development branch and compile a developmental build, or open the beta branch and compile a version sent to beta testers, or open the release branch and compile a stable, public version.` I'm very open to suggestions if you have any. – Yudowat Mar 25 '17 at 12:29
  • Maybe the OP should also look at some articles like [this](http://nvie.com/posts/a-successful-git-branching-model/) to get an idea of how to manage releases. – M. K. Hunter Mar 25 '17 at 12:39
  • That was really interesting @M.K.Hunter, thank you! It looks like i'll be restructuring things to a similar format to that. – Yudowat Mar 25 '17 at 13:02
1

It sounds like you should use git merge. I suggest that you learn about different workflows using git. Git branching and tagging best practices has some great suggestions.

Community
  • 1
  • 1
Code-Apprentice
  • 81,660
  • 23
  • 145
  • 268
  • Merging isn't quite what I'm looking for, as some changes that arent ready to be merged to the next level are made before ones that are ready to be merged, and iirc this would merge all commits, not specific ones – Yudowat Mar 25 '17 at 12:15
  • @Yudowat It seems to me that the `development` branch should be a queue where feature branches which are ready for release can be merged. Presumably, you want to release multiple new features all at once rather than one at a time. If a feature branch isn't ready, then it probably shouldn't be merged into the development branch yet. – Code-Apprentice Mar 25 '17 at 14:58