diff --git a/README.md b/README.md index a3205a84..66beda63 100644 --- a/README.md +++ b/README.md @@ -3,11 +3,12 @@ Guides Guides for getting things done, programming well, and programming in style. -* Product Management with [Trello](/product-management/trello) + * [Protocol](/protocol) * [Code Review](/code-review) * [Best Practices](/best-practices) * [Style](/style) +* [Tools](/tools) High level guidelines: @@ -25,12 +26,14 @@ A note on the language: Credits ------- +This is a branch of the original [Thoughtbot, inc](http://thoughtbot.com/community) [Guides](https://github.com/thoughtbot/guides) + +The original guides have been modified for use by [DigitalAugment Inc.](http://digitalaugment.com) + Thank you, [contributors](https://github.com/thoughtbot/guides/graphs/contributors)! ![thoughtbot](http://thoughtbot.com/images/tm/logo.png) -Guides is maintained by [thoughtbot, inc](http://thoughtbot.com/community). - License ------- diff --git a/best-practices/README.md b/best-practices/README.md index 859aa55f..819be1de 100644 --- a/best-practices/README.md +++ b/best-practices/README.md @@ -132,10 +132,12 @@ JavaScript ---------- * Use CoffeeScript. +* Remove all console.log statements. HTML ---- +* Use haml. * Don't use a reset button for forms. * Prefer cancel links to cancel buttons. diff --git a/code-review/README.md b/code-review/README.md index b06a479c..4608089f 100644 --- a/code-review/README.md +++ b/code-review/README.md @@ -40,7 +40,7 @@ Having your code reviewed * Seek to understand the reviewer's perspective. * Try to respond to every comment. * Wait to merge the branch until another person signs off. -* Wait to merge the branch until Continuous Integration (TDDium, TravisCI, etc.) +* Wait to merge the branch until Continuous Integration ([CodeClimate](https://codeclimate.com), [TravisCI](https://travis-ci.org), etc.) tells you the test suite is green in the branch. Reviewing code diff --git a/protocol/README.md b/protocol/README.md index f71a7c48..5120fd96 100644 --- a/protocol/README.md +++ b/protocol/README.md @@ -3,6 +3,8 @@ Protocol A guide for getting things done. + + +Setup Hub +----------- +Install [hub](https://github.com/defunkt/hub) + + brew install hub + +Alias git to hub by adding this line to you ``.bash_profile`` or ``.profile`` + + alias git='hub' + +Add Git Alias' +------------- + +Added the following to the ``~/.gitconfig`` file. + + [alias] + co = checkout + st = status + aa = add --all + pr = pull-request + create-branch = !sh -c 'git push origin HEAD:refs/heads/$1 && git fetch origin && git branch --track $1 origin/$1 && cd . && git checkout $1' - + merge-branch = !git checkout master && git merge @{-1} + delete-branch = !sh -c 'git push origin :refs/heads/$1 && git remote prune origin && git branch -D $1' - + rebase-origin = !git fetch origin && git rebase origin/master + irebase-origin = !git fetch origin && git rebase -i origin/master + force-push-branch = !git push -f origin HEAD + hard-reset-branch = !sh -c 'git fetch origin && branch=$(git symbolic-ref --short HEAD) && git reset --hard origin/"$branch"' - + Write a feature --------------- -Create a local feature branch based off master. +Create a local feature branch based off master: - git checkout master - git pull - git checkout -b + git co master + git create-branch __ -Prefix the branch name with your initials. +Prefix the branch name with your initials and JIRA ticket number. -Rebase frequently to incorporate upstream changes. +Here is an example branch name: - git fetch origin - git rebase origin/master + mpo_PRJ123_awesome_feature -Resolve conflicts. When feature is complete and tests pass, stage the changes. +If you are the only one working in the branch then you should follow a rebaise +and force push workflow. If you are working with someone else in the branch make +sure you communicate before any rebaising and force pushes. - rake - git add --all +Rebase frequently to incorporate upstream changes and resolve conflicts as needed: -When you've staged the changes, commit them. + git rebase-origin - git status - git commit --verbose +Force push any rebaised changes: + + git force-push-branch + +If you are working with someone else and have to pull a forced pushed branch you +can overwrite your branch with this. + +IMPORTANT: This will overwrite any changes not pushed. + + git hard-reset-branch + +Commit changes regularly. + + git st + git aa # add all changes. or + git add # add single file + git commit -v # Use -v to show diff for help remembering everything changed. Write a [good commit message](http://goo.gl/w11us). Example format: - Present-tense summary under 50 characters + [JIRA-ID] Present-tense summary under 50 characters. * More information about commit (under 72 characters). * More information about commit (under 72 characters). - http://project.management-system.com/ticket/123 +Here is an example commit message: + + [BVR-123] Allow users to sign in with username. + +When feature is complete make sure all tests and reports pass. -Share your branch. + bin/rake - git push origin +Rebase interactively. Squash commits like "Fix whitespace" into one or a +small number of valuable commit(s). Edit commit messages to reveal intent. + + irebase-origin + +Force push to origin: + + git force-push-branch Submit a [GitHub pull request](http://goo.gl/Kmdee). -Ask for a code review in [Campfire](http://campfirenow.com). + git pr + +Link to the code review in JIRA issue comment, assign to reviewer and resolve issue. + + @ Ready for review: http://github.com/organization/project/pull/1 + +Ask for a code review in [Hipchat](http://hipchat.com). Review code ----------- A team member other than the author reviews the pull request. They follow -[Code Review](../code-review) guidelines to avoid -miscommunication. +[Code Review](../code-review) guidelines to avoid miscommunication. They make comments and ask questions directly on lines of code in the Github -web interface or in Campfire. +web interface or in [Hipchat](http://hipchat.com). -For changes which they can make themselves, they check out the branch. +Changes should be made to the same pull request and squished again into a +single commit or small number of valuable commit(s). - git checkout - rake db:migrate - rake - git diff staging/master..HEAD +When satisfied, they comment on the pull request `Ready to merge.` -They make small changes right in the branch, test the feature in browser, -run tests, commit, and push. +The merge master for the project should then be asked to merge the branch. +This can be done on Hipchat or by mentioning them in a JIRA comment. -When satisfied, they comment on the pull request `Ready to merge.` + `@ Ready to merge.` Merge ----- -Rebase interactively. Squash commits like "Fix whitespace" into one or a -small number of valuable commit(s). Edit commit messages to reveal intent. +Checkout the branch and run all tests and validate code quality. - git fetch origin - git rebase -i origin/master - rake + git co branch + git pull + +Make sure all commits are squashed into commits a single logical commit and +rebase with master. + + git irebase-origin + +Run all specs on the rebased branch. + + bin/rake -View a list of new commits. View changed files. Merge branch into master. +Force push the branch to origin. This will update the Pull-Request so it is +closed properly with the merge and can be track later. - git log origin/master.. +View a list of new commits. View changed files. Merge branch into master. This +can also be done by viewing the PR on Github rather then using ``log`` and +``diff`` like shown below. + + git log origin/master..HEAD git diff --stat origin/master - git checkout master - git merge --ff-only - git push + git merge-branch -Delete your remote feature branch. +Only Fast-Forward merges should be done. If the merge is not a Fast-Forward +cancel the merge (deleting all lines in the commit message will cancel the +merge). Rebase with master again and force push the branch to origin. This will +update the Pull-Request so it is closed properly with the merge and can be track +later. - git push origin --delete + git push -Delete your local feature branch. +Delete your local and remote feature branch. Make sure the branch has been +cleanly merged to master before doing this! If in doubt skip this step. - git branch --delete + git delete-branch + + \ No newline at end of file diff --git a/tools/README.md b/tools/README.md new file mode 100644 index 00000000..326676d3 --- /dev/null +++ b/tools/README.md @@ -0,0 +1,25 @@ +Tools +======== + +A guide for finding the right tools. + + +Remote APIs +----------- +Install [httpie](https://github.com/jkbr/httpie). + +Most requests can be done as follows: + + http [HTTP METHOD] [URL] < [JSON FILE WITH PARAMS] + +Example: + + http POST https://some-cool-api.io < create.json + +If you need to send files that are nested you can try to use vanilla curl: + + curl -i -F [parameter] -F [parameter] [url] + +Example: + + curl -i -F 'user_profile[name]=robo' -F 'user_profile[avatar]=@avatar.png' https://some-cool-api.io/user_profile