Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Docs: Add clarification about git workflow #13534

Merged
merged 8 commits into from
Jan 31, 2019
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions docs/contributors/git-workflow.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Git Workflow

## Keeping Your Branch Up To Date

When many different people are working on a project simultaneously, pull requests can go stale quickly. A "stale" pull request is one that is no longer up to date with the main line of development, and it needs to be updated before it can be merged into the project.

While it is tempting to merge from `master` into your branch frequently, this leads to a messy history because each merge creates a merge commit. When working by yourself, it is best to use `git pull --rebase master`, but if you're pushing to a shared repo, it is best to not do any merging or rebasing until the feature is ready for testing, and then do a [rebase](https://github.com/edx/edx-platform/wiki/How-to-Rebase-a-Pull-Request) at the very end. This is one reason why it is important to open pull requests whenever you have working code.
gziolo marked this conversation as resolved.
Show resolved Hide resolved

If you have a Pull Request branch that cannot be merged into `master` due to a conflict (this can happen for long-running Pull Request discussions), it's still best to rebase the branch (rather than merge) and resolve any conflicts on your local copy.
gziolo marked this conversation as resolved.
Show resolved Hide resolved

Once you have resolved any conflicts locally you can update the Pull Request with `git push --force-with-lease`.
gziolo marked this conversation as resolved.
Show resolved Hide resolved

This is how you can bring your branch up to date with the latest changes from `master` branch:
gziolo marked this conversation as resolved.
Show resolved Hide resolved

```sh
git fetch
gziolo marked this conversation as resolved.
Show resolved Hide resolved
git rebase origin/master
gziolo marked this conversation as resolved.
Show resolved Hide resolved
git push --force-with-lease -u origin you-branch-name
gziolo marked this conversation as resolved.
Show resolved Hide resolved
```
2 changes: 1 addition & 1 deletion docs/contributors/repository-management.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,6 @@ When reviewing the issue backlog, here are some steps you can perform:

Gutenberg follows a feature branch pull request workflow for all code and documentation changes. At a high-level, the process looks like this:


1. Check out a new feature branch locally.
2. Make your changes, testing thoroughly.
3. Commit your changes when you’re happy with them, and push the branch.
Expand Down Expand Up @@ -129,6 +128,7 @@ A pull request can generally be merged once it is:
- Vetted against all potential edge cases.
- Changelog entries were properly added.
- Reviewed by someone other than the original author.
- [Rebased](/docs/contributors/git-workflow.md#keeping-your-branch-up-to-date) onto the latest version of the master branch.

The final pull request merge decision is made by the **@wordpress/gutenberg-core** team.

Expand Down
18 changes: 12 additions & 6 deletions docs/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -407,18 +407,24 @@
"markdown_source": "https://raw.githubusercontent.com/WordPress/gutenberg/master/docs/contributors/coding-guidelines.md",
"parent": "develop"
},
{
"title": "Block Grammar",
"slug": "grammar",
"markdown_source": "https://raw.githubusercontent.com/WordPress/gutenberg/master/docs/contributors/grammar.md",
"parent": "develop"
},
{
"title": "Testing Overview",
"slug": "testing-overview",
"markdown_source": "https://raw.githubusercontent.com/WordPress/gutenberg/master/docs/contributors/testing-overview.md",
"parent": "develop"
},
{
"title": "Git Workflow",
"slug": "git-workflow",
"markdown_source": "https://raw.githubusercontent.com/WordPress/gutenberg/master/docs/contributors/git-workflow.md",
"parent": "develop"
},
{
"title": "Block Grammar",
"slug": "grammar",
"markdown_source": "https://raw.githubusercontent.com/WordPress/gutenberg/master/docs/contributors/grammar.md",
"parent": "develop"
},
{
"title": "Scripts",
"slug": "scripts",
Expand Down
3 changes: 2 additions & 1 deletion docs/toc.json
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,9 @@
]},
{"docs/contributors/develop.md": [
{"docs/contributors/coding-guidelines.md": []},
{"docs/contributors/grammar.md": []},
{"docs/contributors/testing-overview.md": []},
{"docs/contributors/git-workflow.md": []},
{"docs/contributors/grammar.md": []},
{"docs/contributors/scripts.md": []},
{"docs/contributors/release.md": []}
]},
Expand Down