{"id":21865232,"url":"https://github.com/gildas/gitflow-pr-sandbox","last_synced_at":"2025-03-21T21:12:45.540Z","repository":{"id":203319696,"uuid":"709319078","full_name":"gildas/gitflow-pr-sandbox","owner":"gildas","description":"Sandbox to illustrate how to use Pull Requests with git flow","archived":false,"fork":false,"pushed_at":"2023-11-06T14:49:21.000Z","size":22,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-15T00:47:34.575Z","etag":null,"topics":["git-flow","methodology","pull-request"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/gildas.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-10-24T13:32:26.000Z","updated_at":"2023-10-26T01:58:25.000Z","dependencies_parsed_at":"2023-10-29T04:18:56.678Z","dependency_job_id":"92fbf01f-05ea-40d4-acc2-1eef22e0bb6d","html_url":"https://github.com/gildas/gitflow-pr-sandbox","commit_stats":null,"previous_names":["gildas/gitflow-pr-sandbox"],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gildas%2Fgitflow-pr-sandbox","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gildas%2Fgitflow-pr-sandbox/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gildas%2Fgitflow-pr-sandbox/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gildas%2Fgitflow-pr-sandbox/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/gildas","download_url":"https://codeload.github.com/gildas/gitflow-pr-sandbox/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244868765,"owners_count":20523591,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["git-flow","methodology","pull-request"],"created_at":"2024-11-28T04:15:15.512Z","updated_at":"2025-03-21T21:12:45.520Z","avatar_url":"https://github.com/gildas.png","language":"Go","readme":"# Git Flow and Pull Request Sandbox\n\nA place to understand how to use Pull Requests with [git-flow](https://github.com/petervanderdoes/gitflow-avh).\n\nWe assume the following:\n\n- You have [git flow (AVH Edition)](https://github.com/petervanderdoes/gitflow-avh) installed,\n- You have [Github's CLI](https://cli.github.com) installed.\n\nThe example app is written in Go, but it does not really matter as we will not even compile it.\n\nFor instructions using [Bitbucket](https://bitbucket.org), please go to the [Bitbucket repository](https://bitbucket.org/gildas_cherruel/gitflow-pr-sandbox).\n\nFor instructions using [GitLab](https://gitlab.com/about), please go to the [GitLab repository](https://gitlab.com/gildas_cherruel/gitflow-pr-sandbox).\n\n## Clone the repository\n\nUsing [gh](https://cli.github.com), let's clone this sandbox:\n\n```sh\ngh repo clone gildas/gitflow-pr-sandbox\n```\n\n## Initialize git flow\n\nOnce inside the repository, initialize [git flow](https://github.com/petervanderdoes/gitflow-avh):\n\n```sh\ngit flow init\n```\n\nMake sure to:\n\n- name the `develop` branch `dev` (I never liked that long label)\n- set the version tag prefix to `v`\n\nIf you want to use my [git flow hooks](https://github.com/gildas/gitflow-hooks), go to its folder, and initialize the hooks with the path of your repository folder:\n```sh\n./hook-it ~/Documents/path/to/gitflow-pr-sandbox\n```\n\nThis will initialize git flow, and copy the appropriate hooks.\n\n## Developing a feature PR style\n\nLet's start our feature:\n\n```sh\ngit flow feature start myfeature\n```\n\nAdd and commit some changes...\n\nYou can share the feature with fellow developers by pushing the branch to the repository (do not use `git flow feature publish` since we will use it to create the Pull Request).\n\n```sh\ngit push --set-upstream origin feature/myfeature\n```\n\nor\n\n```sh\ngit push -u origin feature/myfeature\n```\n\nOnce the feature is finished, publish the feature:\n\n```sh\ngit flow feature publish myfeature\n```\n\nIf you use my [git flow hooks](https://github.com/gildas/gitflow-hooks), the Pull Request will be automatically created.\n\nOtherwise, create the Pull Request:\n\n```sh\ngh pr create \\\n  --title \"Merge feature myfeature\" \\\n  --body  \"Feature myfeature\" \\\n  --base  dev\n```\n\nNow, as the Pull Request reviewer, log on github and merge the Pull Request **without** deleting the feature branch. Or use the CLI:\n\n```sh\ngh pr merge \\\n  --subject 'Merged feature myfeature'\n```\n\nBack to the feature owner, grab the merge:\n\n```sh\ngit checkout dev\ngit pull\n```\n\nAnd finish the feature:\n\n```sh\ngit flow feature finish myfeature\n```\n\n## Baking a release PR style\n\nSince preparing a release usually involves the master branch, typically, the people that take care of that task are usually the maintainers of the project.\n\nLet's start a new release:\n\n```sh\ngit flow release start 1.0.0\n```\n\nIf you use my [git flow hooks](https://github.com/gildas/gitflow-hooks), you will get the auto-versioning for [node.js](https://nodejs.org) and [Go](https://go.dev) based projects.\n\nIf not, you should modify your project's version manually, in the current case:\n\n```sh\nsed -Ei '/VERSION\\s+=/s/[0-9]+\\.[0-9]+\\.[0-9]+/1.0.0/' version.go\ngit add version.go\ngit commit -m \"Bumped to version 1.0.0\" version.go\n```\n\nYou can also share the release branch with others by pushing it to the repository (like features):\n\n```sh\ngit push -u origin release/1.0.0\n```\n\nWhen all bugs have been fixed and the QA process is done, the release should be published to created a Pull Request:\n\n```sh\ngit flow release publish\n```\n\nIf you use my [git flow hooks](https://github.com/gildas/gitflow-hooks), the Pull Request will be automatically created.\n\nOtherwise, create the Pull Request:\n\n```sh\ngh pr create \\\n  --title \"Merge release 1.0.0\" \\\n  --body  \"Release 1.0.0.\" \\\n  --base  master\n```\n\nNow, as the Pull Request reviewer, log on github and merge the Pull Request **without** deleting the release branch. Or use the CLI:\n\n```sh\ngh pr merge \\\n  --subject 'Merged release 1.0.0'\n```\n\nBack to the release _baker_, grab the merge:\n```sh\ngit checkout master\ngit pull\n```\n\nAnd finish the release:\n```sh\ngit flow release finish 1.0.0\n```\n\n## Writing a hotfix PR style\n\nLet's start a new hotfix:\n\n```sh\ngit flow hotfix start 1.0.1\n```\n\nIf you use my [git flow hooks](https://github.com/gildas/gitflow-hooks), you will get the auto-versioning for [node.js](https://nodejs.org) and [Go](https://go.dev) based projects.\n\nIf not, you should modify your project's version manually, in the current case:\n\n```sh\nsed -Ei '/VERSION\\s+=/s/[0-9]+\\.[0-9]+\\.[0-9]+/1.0.1/' version.go\ngit add version.go\ngit commit -m \"Bumped to version 1.0.1\" version.go\n```\n\nYou can also share the hotfix branch with others by pushing it to the repository (like features and releases):\n\n```sh\ngit push -u origin hotfix/1.0.1\n```\n\nWhen all bugs have been fixed and the QA process is done, the hotfix should be published to created a Pull Request:\n\n```sh\ngit flow hotfix publish\n```\n\nIf you use my [git flow hooks](https://github.com/gildas/gitflow-hooks), the Pull Request will be automatically created.\n\nOtherwise, create the Pull Request:\n\n```sh\ngh pr create \\\n  --title \"Merge hotfix 1.0.1\" \\\n  --body  \"Hotfix 1.0.1\" \\\n  --base  master\n```\n\nNow, as the Pull Request reviewer, log on github and merge the Pull Request **without** deleting the hotfix branch. Or use the CLI:\n\n```sh\ngh pr merge \\\n  --subject 'Merged hotfix 1.0.1'\n```\n\nBack to the hotfix maker, grab the merge:\n```sh\ngit checkout master\ngit pull\n```\n\nAnd finish the hotfix:\n```sh\ngit flow hotfix finish 1.0.1\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgildas%2Fgitflow-pr-sandbox","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgildas%2Fgitflow-pr-sandbox","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgildas%2Fgitflow-pr-sandbox/lists"}