3

I have a project in Github where all the team uses Pull Request workflow. So each developer has a Fork of the master repository.

The process for solving an issue of adding a new feature is the following:

  1. The developer creates a branch into his local repository (Fork from master)
  2. The developer starts working on the ticket for solving the issue
  3. Once the developer finish the ticket, he commits the changes to his local repo and push the changes to his Fork in Github
  4. Then, he request a Pull Request from that branch to Master
  5. Team leader access master repository and validates the Pull Request and accepts the changes and merge it to the master.

When we are going to make a publish the code that is published comes from the Master repo but we want to make like a base line of the code that is in Master so any other Pull Request accepted and merged into Master doesnt change the code that we are going to Release.

Does releases functionality from Github is something we can use to take a copy of Master repo code at some point and keep that code unchanged even if some new Pull Request is merged into master?

VAAA
  • 14,531
  • 28
  • 130
  • 253

1 Answers1

5

To answer your question, yes you can do this with releases. GitHub releases are really just git tags. You can't (as far as I know) create a release with a PR, but you can use a tag:

$ git checkout master
$ git pull origin master
$ git tag v1.2.3
$ git push origin master --tags

You will now see v1.2.3 in your "Releases" section on GitHub. You can edit it to make it more verbose, attach binaries, etc.

Tags don't work like branches, but you can make a branch from a tag easily if you ever need to.

Make sure you've got the tags fetched:

git fetch --all --tags --prune

Then check out the tag and create a new branch:

git checkout tags/<tag_name> -b <branch_name>
Jamie Counsell
  • 7,730
  • 6
  • 46
  • 81
  • Thanks Jaime, is there a way to include to a release an specific branch? – VAAA Jan 12 '18 at 16:04
  • Hey @VAAA, I'm really not sure what you mean. You could `git checkout `, then `git tag v1.2.3` then `git push origin --tags`? – Jamie Counsell Jan 12 '18 at 16:57
  • So you mean better to create a "release branch 1.0" from the release, and then I can merge my hotfix branch into that "release branch 1.0" right? – VAAA Jan 12 '18 at 16:59
  • Yep, and only do that if you need to, so there are not branches for every release - only those that need a hotfix – Jamie Counsell Jan 12 '18 at 18:10