Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save boseoladipo/132b77d30671f37ca9a5b016618d687b to your computer and use it in GitHub Desktop.
Save boseoladipo/132b77d30671f37ca9a5b016618d687b to your computer and use it in GitHub Desktop.
Simple Git workflow for collaborating on a project.

How we collaborate

We collaborate using the Github Flow method, as described below;

  • Anything in the master branch is deployable
  • To work on something new, create a descriptively named branch off of master (ie: new-oauth2-scopes)
  • Commit to that branch locally and regularly push your work to the same named branch on the server
  • When you need feedback or help, or you think the branch is ready for merging, open a pull request
  • After someone else has reviewed and signed off on the feature, you can merge it into master
  • Once it is merged and pushed to 'master', you can and should deploy immediately

See the commands for each step outlined below

Cloning the repo

Clone the repository using the url for the repository from github

$ git clone <repo url>

Creating the change

Create a local branch with a descriptive name for the feature

$ git checkout -b my-feature

... modify code, add the files and commit to git locally ....

$ git add <filename> 
$ git commit -m “my feature is this”

... then push the new commit to an upstream branch with the same name. You should push changes immediately as you develop since this does not affect the master (deployed) branch.

$ git push -u origin my-feature

... When you have pushed your final change, create a pull request on the github UI from your feature branch to master.

... After your changes have been reviewed and merged into master, feature branches will be deleted automatically. Otherwise, delete branch (and remote branch) when done

$ git branch -d my-feature 
$ git push origin :my-feature 

To work on a new feature, simply checkout master and pull updates

$ git checkout master
$ git pull

Starting another change

Remove remote branches from your list that have been deleted by other people and repeat the steps outlined above

$ git remote prune origin
$ git checkout -b another-new-feature
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment