Skip to content

Instantly share code, notes, and snippets.

@jbrodriguez
Last active April 28, 2019 08:11
Show Gist options
  • Select an option

  • Save jbrodriguez/480fd9e474579d041860fc7ffb0eaaf2 to your computer and use it in GitHub Desktop.

Select an option

Save jbrodriguez/480fd9e474579d041860fc7ffb0eaaf2 to your computer and use it in GitHub Desktop.

Revisions

  1. jbrodriguez revised this gist Jul 21, 2016. 1 changed file with 20 additions and 20 deletions.
    40 changes: 20 additions & 20 deletions oneflow.md
    Original file line number Diff line number Diff line change
    @@ -2,14 +2,17 @@

    A flow based on [this article](http://endoflineblog.com/follow-up-to-gitflow-considered-harmful)

    Comments from Adam on the original version of this gist can be found [here](https://gist.github.com/skinny85/a84d9cb2df703f96045869ec2582454b)

    ## Original approach

    ### Feature branches

    ```bash
    # let's update master with the latest changes from the remote
    # let's update master with the latest changes from the remote
    # to be safe, make sure you have no unpublished commits on the local master
    git checkout master
    git pull --rebase origin master
    git pull origin master

    # Start work on a feature branch
    git checkout -b feature/awesome
    @@ -29,7 +32,7 @@ git pull --rebase origin master
    git merge feature/awesome # deal with any merge conflicts here

    # push to origin, remove branches
    git push --tags origin master
    git push origin master
    git branch -d feature/awesome
    git push origin --delete feature/awesome
    ```
    @@ -38,10 +41,9 @@ git push origin --delete feature/awesome
    ```bash
    # let's cut a release
    git checkout master
    # note we don't update master, since this is the point we've decided to base our release on

    # Start work on the release branch
    git checkout -b release/1.0.0
    git checkout -b release/1.0.0 <the-commit-you-want-your-release-on>

    # bump versions, add changelog, etc

    @@ -51,7 +53,7 @@ git commit -m "Release 1.0.0"

    # tag the release and push it to the remote
    git tag 1.0.0
    git push --tags origin master
    git push --tags origin release/1.0.0

    # now we merge back to master
    # first update our master from the remote
    @@ -71,9 +73,10 @@ git push origin --delete release/1.0.0

    ### Feature branches
    ```bash
    # let's update master with the latest changes from the remote
    # let's update master with the latest changes from the remote
    # to be safe, make sure you have no unpublished commits on the local master
    git checkout master
    git pull --rebase origin master
    git pull origin master

    # Start work on a feature branch
    git checkout -b feature/awesome
    @@ -96,16 +99,15 @@ git pull --rebase origin master
    git merge --no-ff feature/awesome # no conflicts here

    # push to origin, remove branches
    git push --tags origin master
    git push origin master
    git branch -d feature/awesome
    git push origin --delete feature/awesome
    ```

    ### Release/Hotfix branches
    ```bash
    # let's cut a release
    git checkout master
    # note we don't update master, since this is the point we've decided to base our release on
    git checkout master <the-commit-you-want-your-release-on>

    # Start work on the release branch
    git checkout -b release/1.0.0
    @@ -118,20 +120,18 @@ git commit -m "Release 1.0.0"

    # tag the release and push it to the remote
    git tag 1.0.0
    git push --tags origin master

    # let's update from master by rebasing
    git fetch origin
    git rebase -i origin/master # deal with conflicts here
    git push --tags origin release/1.0.0

    # now we merge back to master
    # first update our master from the remote
    git checkout master
    git pull --rebase origin master

    # then merge the feature branch
    git merge --no-ff release/1.0.0 # no conflicts here
    # then do the actual merge
    git merge release/1.0.0 # deal with merge conflicts here

    # push to origin, remove branches
    # push to origin, delete release branch
    git push --tags origin master
    git branch -d release/1.0.0
    git push origin --delete release/1.0.0
    ```
    ```
  2. jbrodriguez created this gist Jul 21, 2016.
    137 changes: 137 additions & 0 deletions oneflow.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,137 @@
    # oneflow

    A flow based on [this article](http://endoflineblog.com/follow-up-to-gitflow-considered-harmful)

    ## Original approach

    ### Feature branches

    ```bash
    # let's update master with the latest changes from the remote
    git checkout master
    git pull --rebase origin master

    # Start work on a feature branch
    git checkout -b feature/awesome

    # implement awesome feature (feature 1, for example)

    # commit changes
    git add -A
    git commit -m "add feature 1"

    # ok i'm done with this feature branch, let's merge back to master
    # first update master with latest changes from the remote
    git checkout master
    git pull --rebase origin master

    # then merge the feature branch
    git merge feature/awesome # deal with any merge conflicts here

    # push to origin, remove branches
    git push --tags origin master
    git branch -d feature/awesome
    git push origin --delete feature/awesome
    ```

    ### Release/Hotfix branches
    ```bash
    # let's cut a release
    git checkout master
    # note we don't update master, since this is the point we've decided to base our release on

    # Start work on the release branch
    git checkout -b release/1.0.0

    # bump versions, add changelog, etc

    # commit changes
    git add -A
    git commit -m "Release 1.0.0"

    # tag the release and push it to the remote
    git tag 1.0.0
    git push --tags origin master

    # now we merge back to master
    # first update our master from the remote
    git checkout master
    git pull --rebase origin master

    # then do the actual merge
    git merge release/1.0.0 # deal with merge conflicts here

    # push to origin, delete release branch
    git push --tags origin master
    git branch -d release/1.0.0
    git push origin --delete release/1.0.0
    ```

    ## Hybrid approach

    ### Feature branches
    ```bash
    # let's update master with the latest changes from the remote
    git checkout master
    git pull --rebase origin master

    # Start work on a feature branch
    git checkout -b feature/awesome

    # implement awesome feature (feature 1, for example)

    # commit changes
    git add -A
    git commit -m "add feature 1"

    # ok i'm done with this feature branch
    # let's update from master by rebasing
    git fetch origin
    git rebase -i origin/master # deal with conflicts here

    git checkout master
    git pull --rebase origin master

    # then merge the feature branch
    git merge --no-ff feature/awesome # no conflicts here

    # push to origin, remove branches
    git push --tags origin master
    git branch -d feature/awesome
    git push origin --delete feature/awesome
    ```

    ### Release/Hotfix branches
    ```bash
    # let's cut a release
    git checkout master
    # note we don't update master, since this is the point we've decided to base our release on

    # Start work on the release branch
    git checkout -b release/1.0.0

    # bump versions, add changelog, etc

    # commit changes
    git add -A
    git commit -m "Release 1.0.0"

    # tag the release and push it to the remote
    git tag 1.0.0
    git push --tags origin master

    # let's update from master by rebasing
    git fetch origin
    git rebase -i origin/master # deal with conflicts here

    git checkout master
    git pull --rebase origin master

    # then merge the feature branch
    git merge --no-ff release/1.0.0 # no conflicts here

    # push to origin, remove branches
    git push --tags origin master
    git branch -d release/1.0.0
    git push origin --delete release/1.0.0
    ```