Skip to content

Commit

Permalink
Remove rebasing from suggestions in CONTRIBUTING.md (#724)
Browse files Browse the repository at this point in the history
  • Loading branch information
tstirrat authored May 1, 2020
1 parent 6ce9fe1 commit 0fd622d
Showing 1 changed file with 45 additions and 58 deletions.
103 changes: 45 additions & 58 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,71 +23,71 @@ We welcome participation in an open project. We want to make it as easy as possi

cd ~ # get to your home directory or where ever you want to go

git clone https://github.com/YOURACCOUNT/covid-safe-paths
git clone git@github.com:YOURACCOUNT/covid-safe-paths.git

# change into the newly created directory
cd covid-safe-paths

# set upstream against COVID Safe Paths repository
git remote add upstream https://github.com/tripleblindmarket/covid-safe-paths.git
git remote add upstream git@github.com:tripleblindmarket/covid-safe-paths.git

```

(see also how to [fork a repo](https://help.github.com/articles/fork-a-repo/))

## Make Changes

1. Create a branch based on the `develop` branch on your forked repository. Name the branch something to reflect what you are doing. For example, if you want to add a new icon, a branch name you could use:
### Create a branch

1. Always create a new branch from the latest `upstream/develop`:
```bash
git checkout develop # you want to branch from the latest 'develop' branch

git pull upstream/develop # make sure you have the latest code from upstream

git push origin develop # optional, push these changes to YOUR fork's develop branch
```
2. Create the branch. Name the branch something to reflect what you are doing.
```
git checkout -b "feature/new-icon" develop # new branch created!
"or"
git checkout -b "fix/new-icon" develop # new branch created!
"or"
git checkout -b "release/new-icon" develop # new branch created!
```
3. Stick to the coding style and patterns that are used already.
4. Document code! Comments are good. More comments are better. :)
5. Make commits as you desire. Ultimately they will be squashed, so make notes to yourself. It's as simple as `git commit -m "commit message goes here"`!

### Merge upstream/develop into your branch to get the latest changes.

```bash
git checkout develop # you want to branch from the main 'develop' branch
# if you've already done this it will fail, that's fine:
git remote add upstream [email protected]:tripleblindmarket/covid-safe-paths.git

git pull # make sure you have the latest code when you start the branch
# ensure you are on your feature/fix branch
git checkout feature/my-feature

git checkout -b "feature/new-icon" develop # new branch created!
# get latest upstream branches e.g. upstream/develop
git fetch upstream

"or"
# merge upstream/develop into your local branch, this will always create a single merge commit
git merge upstream/develop --no-ff

git checkout -b "fix/new-icon" develop # new branch created!
# you may need to resolve conflicts. If so, resolve them and commit the merge:
git commit

"or"

git checkout -b "release/new-icon" develop # new branch created!
```

2. Stick to the coding style and patterns that are used already.

3. Document code! Comments are good. More comments are better. :)

4. Make commits as you desire. Ultimately they will be squashed, so make

notes to yourself. It's as simple as `git commit -m "commit message goes here"`!

5. Rebase your feature branch with upstream/develop to avoid any code conflicts:

```bash
# 1. Rebase Base(COVID Safe Paths) repository with fork repository - develop branch

git checkout develop # switch to base branch(local)

git fetch upstream # fetch latest commits from "COVID Safe Paths" develop branch

git rebase upstream/develop # rebase code against your forked develop branch(local)

git push -f origin develop # push rebased code after resolving conflicts to forked develop branch(remote)

# 2. Rebase feature branch(local) with develop branch(local)

git checkout <feature-branch-name-you-created> # switch back to original feature branch(local) you are working

git rebase develop # now rebase your feature branch(local) against develop branch(local)

git push origin feature/<your-feature-branch-name> # after resolving all conflicts, push your new feature branch to the remote forked repository
# push your changes up to your branch again
git push -u origin

# now your feature branch is ready for PR against COVID Safe Paths develop branch.
```

6. Start a PR to submit your changes back to the original project:
### Start a PR to submit your changes back to the original project:

- Visit https://github.com/your-git-userid/covid-safe-paths/branches

Expand All @@ -108,25 +108,10 @@ git push origin feature/<your-feature-branch-name> # after resolving all conflic

- Provide a meaningful title and description to your PR, as shown in the above image.
- Provide Issue ID on PR description to link/close the issue upon PR merged.
- If you are changing visuals, please provide screenshots so the PR reviewer can see what you've done without running it in the app.

## Helpful resources on Git

- Git commands:

```
git checkout develop
git fetch
git reset --hard origin/develop
git checkout <your_branch_name>
git rebase develop
git push -f
```

- Documentation on how to [create a Pull Request (PR) on Github](https://help.github.com/articles/using-pull-requests/) for review and merging.

**Note**: Even if you have write access, do not work directly on `master` or push directly to `develop`! All work is done against `develop` reviewed and merged via PRs, and ultimately `develop` gets merged into `master` for tagged code releases.
Expand Down Expand Up @@ -173,6 +158,8 @@ _Advanced users may install the `hub` gem and use the [`hub pull-request` comman

## Reviewing Pull Requests

- If you are using VS Code, use the [GitHub PR extension](https://marketplace.visualstudio.com/items?itemName=GitHub.vscode-pull-request-github), which will allow you to checkout and run anyone's PR with ease.

- Open the PR on Github. At the top of the PR page is a number which identifies it -123 and the name of the author's branch -branch-name. Copy down both of these.

* Open git bash and ensure your working directory is clean by running `git status`
Expand Down

0 comments on commit 0fd622d

Please sign in to comment.