- Did I create my work branch off of development (didn't cut new branches from existing feature branches)?
- Did I follow the correct naming convention for my branch?
- Is my branch focused on a single main change?
- Do all of my changes directly relate to this change?
- Did I write a clear pull request message detailing what changes I made?
- Did I get a code review?
- Did I make any requested changes from that code review?
git status
will tell you if your changes are staged, unstaged, or a clean slate.git branch -a
will tell you what branch you are currently on.
$ git clone https://github.com/polinadotio/trendr.git
$ cd
$ git remote add upstream https://github.com/mks-greenfield/trendr.git
$ git branch -a
- Fork the repo.
- Clone from the forked version on your Github account to your local machine.
git clone https://github.com/<USER-NAME>/<REPO_NAME>.git
- Add a remote pointing to the original (upstream) repository.
git remote add upstream https://github.com/<REPOSITORY_NAME>/repository.git
git pull upstream development
npm install
to install both NPM and Bower dependencies
$ git checkout -b feat-branch origin/development
Branch development set up to track remote branch development from origin.
Switched to a new branch 'feat-branch'
$ git branch -a
$ git pull upstream development
From https://github.com/mks-greenfield/trendr
* branch development -> FETCH_HEAD
Already up-to-date.
$ git add -A
$ git status
$ git commit -m "[feat] Add feature"
$ git pull upstream development
$ git push origin feat-branch
- Create a feature branch from your local master.
git checkout -b [name_of_your_new_branch]
- Prefix your branch name with what you are working on:
- Example:
feat-authentication
- bug-...
- feat-...
- test-...
- doc-...
- refactor-...
- Example:
- View all branches:
git branch -a
- To create a branch off a remote branch that is not master:
git checkout -b [name_of_your_new_branch] origin/[name of remote branch]
- Commit every time you implement a working piece of your program. Try not to add 10 lines of code in 1 file and 20 lines in another unrelated file before committing once.
- To stage files to commit, you can cover your bases by using
git add -A
. However you can use any of the following:
git add -A
: Stage all (new, modified, deleted) files.git add .
: Stage new and modified files only.git add -u
: Stage modified and deleted files only.git add [filename]
: Stage specific file.
- Use
git status
to verify that you've staged all files you wanted to change. git commit
to add changes.
- Pull updated code from the original source repo into your local clone by running
git pull upstream development
. - Push your feature branch to a branch on your forked Repository on Github:
git push origin <branch-name>
.
- Use the present tense.
- When making commits to your feature branch, prefix each commit.
- Example:
git commit -m '[feat] Add a new feature'
- [feat] Add a new feature
- [fix] Fix inconsistent tests [Fixes #0]
- [refactor] ...
- [cleanup] ...
- [test] ...
- [doc] ...
A guide for reviewing code and having your code reviewed.
####Everyone
- Accept that many programming decisions are opinions. Discuss tradeoffs, which you prefer, and reach a resolution quickly.
- Ask questions; don't make demands. ("What do you think about naming this
user_id
?") - Ask for clarification. ("I didn't understand. Can you clarify?")
- Avoid selective ownership of code. ("mine", "not mine", "yours")
- Avoid using terms that could be seen as referring to personal traits. ("dumb", "stupid"). Assume everyone is attractive, intelligent, and well-meaning.
- Be explicit. Remember people don't always understand your intentions online.
- Be humble. ("I'm not sure - let's look it up.")
- Don't use hyperbole. ("always", "never", "endlessly", "nothing")
- Don't use sarcasm.
- Keep it real.
- Talk in person if there are too many "I didn't understand" or "Alternative solution:" comments. Post a follow-up comment summarizing offline discussion.
Understand why the code is necessary (bug, user experience, refactoring). Then:
- Communicate which ideas you feel strongly about and those you don't.
- Identify ways to simplify the code while still solving the problem.
- If discussions turn too philosophical or academic, move the discussion offline to a regular Friday afternoon technique discussion. In the meantime, let the author make the final decision on alternative implementations.
- Offer alternative implementations, but assume the author already considered them. ("What do you think about using a custom validator here?")
- Seek to understand the author's perspective.
- Sign off on the pull request with a 👍 or "Ready to merge" comment.
- Be grateful for the reviewer's suggestions. ("Good call. I'll make that change.")
- Don't take it personally. The review is of the code, not you.
- Explain why the code exists. ("It's like that because of these reasons. Would it be more clear if I rename this class/file/method/variable?")
- Seek to understand the reviewer's perspective.
- Try to respond to every comment.
- Wait for the Scrum Master to merge your Pull Request.