Skip to content

Instantly share code, notes, and snippets.

@clarissachin
Forked from belcortes/git-workflow.md
Created April 16, 2018 01:50
Show Gist options
  • Save clarissachin/bdc4de24cee6ac9ad71e14727dc9b2fb to your computer and use it in GitHub Desktop.
Save clarissachin/bdc4de24cee6ac9ad71e14727dc9b2fb to your computer and use it in GitHub Desktop.

Git Workflow

  1. Development starts with an assigned issue (or a user story).

  2. Cut a feature branch off master for the issue:

    $ git checkout master
    $ git pull
    $ git checkout -b <issue num>_<description>   # e.g. 	123_reset_password_email
    
  3. Create a remote tracking branch, allowing others to see/comment on the feature branch

    $ git push origin <issue num>_<description>
    
  4. Proceed with development locally, commit and push often until you are done and ready for code review.

  5. Make a pull request on Github using the following template:

    Issue 123: Issue summary

    https://github.com/example/example-project/issues/123

    Description of changes More description of changes More description of changes

  6. Complete all verification steps including code review.

  7. Rebase interactively master into your feature branch in order to it clean

    $ git fetch origin master:master
    $ git checkout <issue num>_<description>
    $ git rebase master
    $ git rebase -i HEAD~3 # in order to squash the last 3 commits (might be more or less than 3)
    
  8. Merge the feature branch into master

    $ git checkout master
    $ git pull
    $ git merge --no-ff --no-commit <issue_num>_<description>
    $ git commit # using the commit message template 
    $ git push origin master
    
  9. Close the pull request in Github.

  10. Remove the feature branch

    $ git checkout master
    $ git branch -D <issue_num>_<description> # remove the feature branch locally
    $ git push origin :<issue_num>_description> # remove the remote branch
    
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment