Skip to content

Commit 8e33c3c

Browse files
committed
Started on GitHubFlow examples
1 parent 775e59a commit 8e33c3c

File tree

6 files changed

+79
-4
lines changed

6 files changed

+79
-4
lines changed

docs/git-branching-strategies/gitflow-examples.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,16 @@
11
# GitFlow Examples
2+
These examples are using the *default* configuration with GitVersion. Which is [continuous deployment](../reference/continuous-deployment.md) mode for `develop` and [continuous delivery](../reference/continuous-delivery.md) mode for all other branches.
3+
4+
This default configuration allows you to publish CI builds from develop to a CI MyGet feed, or another CI feed. Then all other branches are manually released then tagged. Read more about this at [version increments](../more-info/version-increments.md).
5+
26
## Feature Branches
37
Feature branches will take the feature branch name and use that as the pre-release tag.
48

59
![GitFlow](img/05119d0cd4ecaaefff94_feature-branch.png)
610

11+
Notice after the feature branch is merged, the version on `develop` is `1.3.0-unstable.3`. This is due to `develop` running in *continuous deployment* mode. If you configured `develop` to use *continuous delivery* the version would still be `1.3.0-unstable.1` and you would have to use release tags to increment the `unstable.1`.
12+
13+
You can see the different on the feature branch itself, notice the version is the same before and after the commit on the feature branch? Only the metadata has changed. If you released the feature branch artifacts then tagged the commit, the following commit would increase to `-beta.2`.
714

815
## Pull Request
916
Because feature branches are most likely pushed to a fork, we are showing the
Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# GitHubFlow Examples
2-
## Continuous Delivery mode
3-
TODO Example of GitHubFlow using continuous delivery mode
42

5-
## Continuous Deployment mode
6-
TODO Example of GitHubFlow using continuous deployment mode
3+
## Feature branch
4+
![GitFlow](img/githubflow_feature-branch.png)
5+
6+
## Pull requests
7+
![GitFlow](img/githubflow_pull-request.png)

docs/git-branching-strategies/githubflow.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,5 @@ The main rule of GitHub Flow is that master should *always* be deployable. GitHu
1515
## Resources
1616
- [GitHubFlow guide by GitHub](https://guides.github.com/introduction/flow/index.html)
1717
- [GitHub Flow original blog post](http://scottchacon.com/2011/08/31/github-flow.html)
18+
- [Phil Haack's (haacked) GitHubFlow aliases](http://haacked.com/archive/2014/07/28/github-flow-aliases/)
19+
- [GitHubFlow vs GitFlow](http://lucamezzalira.com/2014/03/10/git-flow-vs-github-flow/)
16.9 KB
Loading
17.3 KB
Loading

src/GitVersionCore.Tests/IntegrationTests/DocumentationSamples.cs

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -302,4 +302,69 @@ public void GitFlowSupportMinorRelease()
302302
fixture.AssertFullSemver("1.4.0");
303303
}
304304
}
305+
306+
307+
[Test]
308+
public void GitHubFlowFeatureBranch()
309+
{
310+
using (var fixture = new EmptyRepositoryFixture(new Config()))
311+
{
312+
fixture.Participant("master");
313+
314+
// GitFlow setup
315+
fixture.Repository.MakeACommit();
316+
fixture.ApplyTag("1.2.0");
317+
318+
// Branch to develop
319+
fixture.MakeACommit();
320+
fixture.AssertFullSemver("1.2.1+1");
321+
322+
// Open Pull Request
323+
fixture.BranchTo("feature/myfeature", "feature");
324+
fixture.Activate("feature/myfeature");
325+
fixture.AssertFullSemver("1.2.1-myfeature.1+1");
326+
fixture.MakeACommit();
327+
fixture.AssertFullSemver("1.2.1-myfeature.1+2");
328+
329+
// Merge into master
330+
fixture.Checkout("master");
331+
fixture.MergeNoFF("feature/myfeature");
332+
fixture.Destroy("feature/myfeature");
333+
fixture.NoteOver("Feature branches should\r\n" +
334+
"be deleted once merged", "feature/myfeature");
335+
fixture.AssertFullSemver("1.2.1+3");
336+
}
337+
}
338+
339+
[Test]
340+
public void GitHubFlowPullRequestBranch()
341+
{
342+
using (var fixture = new EmptyRepositoryFixture(new Config()))
343+
{
344+
fixture.Participant("master");
345+
346+
// GitFlow setup
347+
fixture.Repository.MakeACommit();
348+
fixture.ApplyTag("1.2.0");
349+
350+
// Branch to develop
351+
fixture.MakeACommit();
352+
fixture.AssertFullSemver("1.2.1+1");
353+
354+
// Open Pull Request
355+
fixture.BranchTo("pull/2/merge", "pr");
356+
fixture.Activate("pull/2/merge");
357+
fixture.AssertFullSemver("1.2.1-PullRequest.2+1");
358+
fixture.MakeACommit();
359+
fixture.AssertFullSemver("1.2.1-PullRequest.2+2");
360+
361+
// Merge into master
362+
fixture.Checkout("master");
363+
fixture.MergeNoFF("pull/2/merge");
364+
fixture.Destroy("pull/2/merge");
365+
fixture.NoteOver("Feature branches/pr's should\r\n" +
366+
"be deleted once merged", "pull/2/merge");
367+
fixture.AssertFullSemver("1.2.1+3");
368+
}
369+
}
305370
}

0 commit comments

Comments
 (0)