Skip to content
Open
Changes from 2 commits
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
31 changes: 17 additions & 14 deletions contributions/pull-requests.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,19 +56,19 @@ If you haven't submitted a pull request before, you'll want to install WP-CLI fo

### Working on a specific command/package

1. Install [Composer](https://getcomposer.org/) and [hub](https://hub.github.com/) if you don't already have them.
2. Clone the git repository of the command/package you want to work on to your local machine. As an example for working on the `wp core` command: `hub clone wp-cli/core-command`
3. Change into the cloned directory and fork WP-CLI: `cd core-command`.
1. Install [Composer](https://getcomposer.org/) if you don't already have it.
2. Clone the git repository of the command/package you want to work on to your local machine. As an example for working on the `wp core` command: `git clone https://github.com/wp-cli/core-command.git`
3. Change into the cloned directory: `cd core-command`
4. Install all Composer dependencies: `composer install`
5. Verify WP-CLI was installed properly: `vendor/bin/wp --info`

Within this package, you should preferably use `vendor/bin/wp` to run the command. Just using `wp` should work as well, but by doing that you might run the command through a different version of the framework and thus getting an unexpected result.

### Working on the project as a whole

1. Install [Composer](https://getcomposer.org/) and [hub](https://hub.github.com/) if you don't already have them.
1. Install [Composer](https://getcomposer.org/) if you don't already have it.
2. Clone the WP-CLI git repository to your local machine: `git clone [email protected]:wp-cli/wp-cli.git ~/wp-cli`
3. Change into the cloned directory and fork WP-CLI: `cd ~/wp-cli`. If you are going to work on the core framework itself, run `hub fork` here to create a pushable repository on GitHub.
3. Change into the cloned directory: `cd ~/wp-cli`. If you are going to work on the core framework itself, fork the repository on GitHub through the web UI and add it as a remote: `git remote add fork [email protected]:yourusername/wp-cli.git`
4. Install all Composer dependencies: `composer install --prefer-source`
5. Alias the `wp` command to your new WP-CLI install: `alias wp='~/wp-cli/bin/wp'`
6. Verify WP-CLI was installed properly: `wp --info`
Expand All @@ -77,19 +77,22 @@ Commands bundled with WP-CLI (e.g. `wp scaffold plugin`) will be editable from t

Commands available for standalone installation (e.g. `wp dist-archive`) can be installed from source (e.g. `wp package install [email protected]:wp-cli/dist-archive-command.git`). Run `wp package path <package-name>` to find the appropriate directory to edit.

Importantly, you'll need to fork each repository in order to have an `origin` to push to. Run `hub fork` to fork a repository from the command-line:
Importantly, you'll need to fork each repository in order to have a remote to push to. For each repository you want to contribute to:

1. Fork the repository on GitHub through the web UI
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@swissspidy We need describe it in more details or link to GitHub documentation

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot add such a link please

2. Add your fork as a remote:

$ cd vendor/wp-cli/scaffold-command
$ hub fork
Updating danielbachhuber
From https://github.com/wp-cli/scaffold-command
* [new branch] master -> danielbachhuber/master
new remote: danielbachhuber
$ git remote add fork [email protected]:yourusername/scaffold-command.git
$ git remote -v
danielbachhuber [email protected]:danielbachhuber/scaffold-command.git (fetch)
danielbachhuber [email protected]:danielbachhuber/scaffold-command.git (push)
origin https://github.com/wp-cli/scaffold-command.git (fetch)
origin https://github.com/wp-cli/scaffold-command.git (push)
fork [email protected]:yourusername/scaffold-command.git (fetch)
fork [email protected]:yourusername/scaffold-command.git (push)

Once you've done so, you'll have a fork in your GitHub account and a new remote you can push to. You can then push changes to your fork with `git push fork branch-name`.

Once you've done so, you'll have a fork in your GitHub account and new remote you can push to. If you didn't install `hub`, you'll need to fork the target repo through the web UI and manually add your fork as a remote.
**Optional:** The [GitHub CLI (`gh`)](https://cli.github.com/) can help streamline some of these tasks, such as forking repositories and creating pull requests from the command line.

## Running and writing tests

Expand Down
Loading