Skip to content

Instantly share code, notes, and snippets.

@leesmith
Last active December 30, 2023 23:37
Show Gist options
  • Select an option

  • Save leesmith/8441773 to your computer and use it in GitHub Desktop.

Select an option

Save leesmith/8441773 to your computer and use it in GitHub Desktop.

Revisions

  1. leesmith revised this gist Sep 10, 2019. 1 changed file with 2 additions and 1 deletion.
    3 changes: 2 additions & 1 deletion simple-git-workflow.md
    Original file line number Diff line number Diff line change
    @@ -80,5 +80,6 @@
    ### Credits
    http://blogs.atlassian.com/2014/01/simple-git-workflow-simple/
    https://www.atlassian.com/it/git/articles/simple-git-workflow-is-simple
    https://gist.github.com/jbenet/ee6c9ac48068889b0912
  2. leesmith revised this gist Jan 23, 2014. 1 changed file with 2 additions and 7 deletions.
    9 changes: 2 additions & 7 deletions simple-git-workflow.md
    Original file line number Diff line number Diff line change
    @@ -34,12 +34,6 @@
    git rebase master
    ```
    If this is a shared remote feature branch, also rebase those changes:
    ```
    git rebase origin/concise-feature-branch-name
    ```
    Resolve any conflicts that occur during rebase.
    5. Push your branch remotely and create a pull request when ready for peer review:
    @@ -58,6 +52,7 @@
    ```
    git checkout master
    git pull origin master
    # The --no-ff is optional here...see the notes below
    git merge --no-ff concise-feature-branch-name
    git push origin master
    # This is also a good time to create a release tag
    @@ -77,7 +72,7 @@
    ```
    git config --global branch.autosetuprebase always
    git config --global pull.rebase preserve
    git config --global pull.rebase true
    ```
    - Merging into master in step 7 with the --no-ff option will create a merge commit even if the merge could be a fast-forward. Having this merge commit is helpful in that it retains the commits that went into the feature branch. (If you don't care to keep this series of commits on a feature branch or the feature branch was a single commit, you can omit the `--no-ff` in the merge command and let it fast-foward.) Single-level merge bubbles like this are ok. Here's what we don't want:
  3. leesmith revised this gist Jan 17, 2014. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion simple-git-workflow.md
    Original file line number Diff line number Diff line change
    @@ -79,7 +79,7 @@
    git config --global branch.autosetuprebase always
    git config --global pull.rebase preserve
    ```
    - Merging into master in step 7 with the --no-ff option will create a merge commit even if the merge could be a fast-forward. Having this merge commit is good to see the life of a feature branch and the commits that went into. (If you don't care to keep this series of commits on a feature branch or the feature branch was a single commit, you can omit the `--no-ff` in the merge command and let it fast-foward.) Single-level merge bubbles like this are ok. Here's what we don't want:
    - Merging into master in step 7 with the --no-ff option will create a merge commit even if the merge could be a fast-forward. Having this merge commit is helpful in that it retains the commits that went into the feature branch. (If you don't care to keep this series of commits on a feature branch or the feature branch was a single commit, you can omit the `--no-ff` in the merge command and let it fast-foward.) Single-level merge bubbles like this are ok. Here's what we don't want:
    ![merge-bubbles](http://i.imgur.com/ICmAmkY.png)
  4. leesmith revised this gist Jan 15, 2014. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion simple-git-workflow.md
    Original file line number Diff line number Diff line change
    @@ -65,7 +65,7 @@
    git push 1.0.10
    ```
    8. Clean up branches:
    8. Remove all branches that have been merged into master:
    ```
    git branch -d concise-feature-branch-name
    git push origin :concise-feature-branch-name
  5. leesmith revised this gist Jan 15, 2014. 1 changed file with 1 addition and 0 deletions.
    1 change: 1 addition & 0 deletions simple-git-workflow.md
    Original file line number Diff line number Diff line change
    @@ -64,6 +64,7 @@
    git tag 1.0.10
    git push 1.0.10
    ```
    8. Clean up branches:
    ```
    git branch -d concise-feature-branch-name
  6. leesmith revised this gist Jan 15, 2014. 1 changed file with 5 additions and 0 deletions.
    5 changes: 5 additions & 0 deletions simple-git-workflow.md
    Original file line number Diff line number Diff line change
    @@ -64,6 +64,11 @@
    git tag 1.0.10
    git push 1.0.10
    ```
    8. Clean up branches:
    ```
    git branch -d concise-feature-branch-name
    git push origin :concise-feature-branch-name
    ```
    ### Notes
  7. leesmith created this gist Jan 15, 2014.
    83 changes: 83 additions & 0 deletions simple-git-workflow.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,83 @@
    # Simple Git Workflow For Continuous Delivery

    ### Workflow guidelines:
    * `master` branch is always production-ready, deployable, 100% green test suite
    * New development is done on feature branches, with frequent rebasing onto master
    * Clean commit history by preferring to rebase instead of merge (`git pull` is configured to automatically rebase)

    ![rebase workflow](http://i.imgur.com/5hrT1SO.gif)

    ### Workflow

    1. Pull the latest from `origin/master`:
    ```
    git pull origin master
    ```
    2. Create your feature branch
    ```
    git checkout -b concise-feature-branch-name
    ```
    3. Begin work on the new feature
    4. Keep your feature branch updated with master by rebasing onto master:
    ```
    git fetch origin master
    git rebase origin/master
    ```
    or
    ```
    git checkout master
    git pull
    git checkout concise-feature-branch-name
    git rebase master
    ```
    If this is a shared remote feature branch, also rebase those changes:
    ```
    git rebase origin/concise-feature-branch-name
    ```
    Resolve any conflicts that occur during rebase.
    5. Push your branch remotely and create a pull request when ready for peer review:
    ```
    git push -u origin concise-feature-branch-name
    ```
    Depending on peer review, keep pushing changes to the remote as needed.
    6. Interactively rebase your feature branch onto master once the feature is approved and ready for production:
    ```
    git rebase -i origin/master
    ```
    7. Merge into `master`:
    ```
    git checkout master
    git pull origin master
    git merge --no-ff concise-feature-branch-name
    git push origin master
    # This is also a good time to create a release tag
    git tag 1.0.10
    git push 1.0.10
    ```
    ### Notes
    - Git config for rebasing by default:
    ```
    git config --global branch.autosetuprebase always
    git config --global pull.rebase preserve
    ```
    - Merging into master in step 7 with the --no-ff option will create a merge commit even if the merge could be a fast-forward. Having this merge commit is good to see the life of a feature branch and the commits that went into. (If you don't care to keep this series of commits on a feature branch or the feature branch was a single commit, you can omit the `--no-ff` in the merge command and let it fast-foward.) Single-level merge bubbles like this are ok. Here's what we don't want:
    ![merge-bubbles](http://i.imgur.com/ICmAmkY.png)
    ### Credits
    http://blogs.atlassian.com/2014/01/simple-git-workflow-simple/
    https://gist.github.com/jbenet/ee6c9ac48068889b0912