Skip to content

Commit

Permalink
Merge pull request #6222 from kenjis/fix-contributing-PR
Browse files Browse the repository at this point in the history
docs: improve contributing Pull Request
  • Loading branch information
kenjis authored Jul 4, 2022
2 parents ddf26e5 + 4e47e36 commit edb894f
Show file tree
Hide file tree
Showing 2 changed files with 77 additions and 37 deletions.
7 changes: 6 additions & 1 deletion contributing/pull_request.md
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,12 @@ The best way to contribute is to fork the CodeIgniter4 repository, and "clone" t
- `> cd CodeIgniter4/`
- `> composer update`
6. Create a new [branch](https://help.github.com/en/articles/about-branches) in your project for each set of changes you want to make.
- `> git checkout -b <new-branch-name>`
- If your PR is for bug fixes:
- `> git switch develop`
- `> git switch -c <new-branch-name>`
- If your PR has any enhancement, create new branch from next minor version branch, e.g. __"4.3"__:
- `> git switch <next-minor-version-branch>`
- `> git switch -c <new-branch-name>`
7. Fix existing bugs on the [Issue tracker](https://github.com/codeigniter4/CodeIgniter4/issues) after confirming that no one else is working on them.
8. [Commit](https://help.github.com/en/desktop/contributing-to-projects/committing-and-reviewing-changes-to-your-project) the changed files in your contribution branch.
- `> git commit`
Expand Down
107 changes: 71 additions & 36 deletions contributing/workflow.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,10 @@ ORIGIN\_URL.

Clone your repository, leaving a local folder for you to work with:

cd ALL_PROJECTS
git clone ORIGIN_URL
```console
> cd ALL_PROJECTS
> git clone ORIGIN_URL
```

## Syncing your repository

Expand All @@ -72,16 +74,20 @@ an alias for the shared repository as well, so that you can "synch" the
two, making sure that your repository includes any other contributions
that have been merged by us into the shared repo:

git remote add upstream UPSTREAM_URL
```console
> git remote add upstream UPSTREAM_URL
```

Then synchronizing is done by pulling from us and pushing to you. This
is normally done locally, so that you can resolve any merge conflicts.
For instance, to synchronize **develop** branches:

git switch develop
git fetch upstream
git merge upstream/develop
git push origin develop
```console
> git switch develop
> git fetch upstream
> git merge upstream/develop
> git push origin develop
```

You might get merge conflicts when you merge. It is your
responsibility to resolve those locally, so that you can continue
Expand All @@ -105,12 +111,25 @@ This local branch should be named appropriately, for instance
"fix/problem123" or "new/mind-reader". The slashes in these branch names
is optional, and implies a sort of namespacing if used.

For instance, make sure you are in the *develop* branch, and create a
new feature branch, based on *develop*, for a new feature you are
- All bug fix PRs should be sent to the __"develop"__ branch, this is where the next bug fix version will be developed.
- PRs with any enhancement should be sent to next minor version branch, e.g. __"4.3"__

For instance, if you send a PR to __"develop"__ branch, make sure you are in the *develop* branch, and create a
new bugfix branch, based on *develop*, for a new feature you are
creating:

git switch develop
git switch -c new/mind-reader
```console
> git switch develop
> git switch -c fix/problem123
```

If you send a PR with an enhancement, make sure you are in the *next minor version* branch,
and create a new feature branch, based on, e.g., *4.3*, for a new feature you are creating:

```console
> git switch 4.3
> git switch -c new/mind-reader
```

Saving changes only updates your local working area.

Expand All @@ -123,23 +142,27 @@ in.
You can have as many commits in a branch as you need to "get it right".
For instance, to commit your work from a debugging session:

git add .
git commit -S -m "Find and fix the broken reference problem"
```console
> git add .
> git commit -S -m "Find and fix the broken reference problem"
```

Just make sure that your commits in a feature branch are all related.

If you are working on two features at a time, then you will want to
switch between them to keep the contributions separate. For instance:

git switch new/mind-reader
// work away
git add .
git commit -S -m "Added adapter for abc"
git switch fix/issue-123
// work away
git add .
git commit -S -m "Fixed problem in DEF\Something"
git switch develop
```console
> git switch new/mind-reader
> ## work away
> git add .
> git commit -S -m "Added adapter for abc"
> git switch fix/issue-123
> ## work away
> git add .
> git commit -S -m "Fixed problem in DEF\Something"
> git switch develop
```

The last checkout makes sure that you end up in your *develop* branch as
a starting point for your next session working with your repository.
Expand All @@ -157,19 +180,25 @@ It is a lot easier to resolve conflicts at this stage.

Synchronize your repository:

git switch develop
git fetch upstream
git merge upstream/develop
git push origin develop
```console
> git switch develop
> git fetch upstream
> git merge upstream/develop
> git push origin develop
```

Bring your feature branch up to date:

git switch new/mind-reader
git rebase upstream/develop
```console
> git switch fix/issue-123
> git rebase upstream/develop
```

And finally push your local branch to your GitHub repository:

git push --force-with-lease origin new/mind-reader
```console
> git push --force-with-lease origin fix/issue-123
```

## Pull Requests

Expand Down Expand Up @@ -223,23 +252,29 @@ do the following:

Synchronize your repository:

git switch develop
git fetch upstream
git merge upstream/develop
git push origin develop
```console
> git switch develop
> git fetch upstream
> git merge upstream/develop
> git push origin develop
```

Bring your feature branch up to date:

git switch new/mind-reader
git rebase upstream/develop
```console
> git switch fix/problem123
> git rebase upstream/develop
```

You might get conflicts when you rebase. It is your
responsibility to resolve those locally, so that you can continue
collaborating with the shared repository.

And finally push your local branch to your GitHub repository:

git push --force-with-lease origin new/mind-reader
```console
> git push --force-with-lease origin fix/problem123
```

## Cleanup

Expand Down

0 comments on commit edb894f

Please sign in to comment.