2017-11-23 20:21:57 +01:00
|
|
|
# Get Zulip code
|
|
|
|
|
|
|
|
Zulip uses a **forked-repo** and **[rebase][gitbook-rebase]-oriented
|
2020-09-12 00:47:09 +02:00
|
|
|
workflow**. This means that all contributors create a fork of the [Zulip
|
2017-11-23 20:21:57 +01:00
|
|
|
repository][github-zulip] they want to contribute to and then submit pull
|
|
|
|
requests to the upstream repository to have their contributions reviewed and
|
|
|
|
accepted. We also recommend you work on feature branches.
|
|
|
|
|
|
|
|
## Step 1a: Create your fork
|
|
|
|
|
2020-10-13 23:50:18 +02:00
|
|
|
The following steps you'll only need to do the first time you set up a machine
|
2017-11-23 20:21:57 +01:00
|
|
|
for contributing to a given Zulip project. You'll need to repeat the steps for
|
|
|
|
any additional Zulip projects ([list][github-zulip]) that you work on.
|
|
|
|
|
|
|
|
The first thing you'll want to do to contribute to Zulip is fork ([see
|
|
|
|
how][github-help-fork]) the appropriate [Zulip repository][github-zulip]. For
|
|
|
|
the main server app, this is [zulip/zulip][github-zulip-zulip].
|
|
|
|
|
|
|
|
## Step 1b: Clone to your machine
|
|
|
|
|
|
|
|
Next, clone your fork to your local machine:
|
|
|
|
|
2021-08-20 07:09:04 +02:00
|
|
|
```console
|
2019-10-31 20:27:33 +01:00
|
|
|
$ git clone --config pull.rebase https://github.com/YOUR_USERNAME/zulip.git
|
2017-11-23 20:21:57 +01:00
|
|
|
Cloning into 'zulip'
|
|
|
|
remote: Counting objects: 86768, done.
|
|
|
|
remote: Compressing objects: 100% (15/15), done.
|
|
|
|
remote: Total 86768 (delta 5), reused 1 (delta 1), pack-reused 86752
|
|
|
|
Receiving objects: 100% (86768/86768), 112.96 MiB | 523.00 KiB/s, done.
|
|
|
|
Resolving deltas: 100% (61106/61106), done.
|
|
|
|
Checking connectivity... done.
|
|
|
|
```
|
|
|
|
|
|
|
|
(The `--config pull.rebase` option configures Git so that `git pull`
|
2021-08-20 21:53:28 +02:00
|
|
|
will behave like `git pull --rebase` by default. Using
|
2021-09-08 00:23:24 +02:00
|
|
|
`git pull --rebase` to update your changes to resolve merge conflicts
|
|
|
|
is expected by essentially all of open source projects, including
|
2021-08-20 21:53:28 +02:00
|
|
|
Zulip. You can also set that option after cloning using
|
2021-09-08 00:23:24 +02:00
|
|
|
`git config --add pull.rebase true`, or just be careful to always run
|
|
|
|
`git pull --rebase`, never `git pull`).
|
2017-11-23 20:21:57 +01:00
|
|
|
|
|
|
|
Note: If you receive an error while cloning, you may not have [added your ssh
|
|
|
|
key to GitHub][github-help-add-ssh-key].
|
|
|
|
|
2017-11-26 18:14:28 +01:00
|
|
|
Once the repository is cloned, we recommend running
|
|
|
|
[setup-git-repo][zulip-rtd-tools-setup] to install Zulip's pre-commit
|
|
|
|
hook which runs the Zulip linters on the changed files when you
|
|
|
|
commit.
|
|
|
|
|
2017-11-23 20:21:57 +01:00
|
|
|
## Step 1c: Connect your fork to Zulip upstream
|
|
|
|
|
|
|
|
Next you'll want to [configure an upstream remote
|
|
|
|
repository][github-help-conf-remote] for your fork of Zulip. This will allow
|
|
|
|
you to [sync changes][github-help-sync-fork] from the main project back into
|
|
|
|
your fork.
|
|
|
|
|
|
|
|
First, show the currently configured remote repository:
|
|
|
|
|
2021-08-20 07:09:04 +02:00
|
|
|
```console
|
2017-11-23 20:21:57 +01:00
|
|
|
$ git remote -v
|
|
|
|
origin git@github.com:YOUR_USERNAME/zulip.git (fetch)
|
|
|
|
origin git@github.com:YOUR_USERNAME/zulip.git (push)
|
|
|
|
```
|
|
|
|
|
|
|
|
Note: If you've cloned the repository using a graphical client, you may already
|
|
|
|
have the upstream remote repository configured. For example, when you clone
|
|
|
|
[zulip/zulip][github-zulip-zulip] with the GitHub desktop client it configures
|
2021-09-08 00:23:24 +02:00
|
|
|
the remote repository `zulip` and you see the following output from
|
|
|
|
`git remote -v`:
|
2017-11-23 20:21:57 +01:00
|
|
|
|
2021-08-20 07:09:04 +02:00
|
|
|
```console
|
2017-11-23 20:21:57 +01:00
|
|
|
origin git@github.com:YOUR_USERNAME/zulip.git (fetch)
|
|
|
|
origin git@github.com:YOUR_USERNAME/zulip.git (push)
|
|
|
|
zulip https://github.com/zulip/zulip.git (fetch)
|
|
|
|
zulip https://github.com/zulip/zulip.git (push)
|
|
|
|
```
|
|
|
|
|
|
|
|
If your client hasn't automatically configured a remote for zulip/zulip, you'll
|
|
|
|
need to with:
|
|
|
|
|
2021-08-20 07:09:04 +02:00
|
|
|
```console
|
2018-02-16 11:42:34 +01:00
|
|
|
$ git remote add -f upstream https://github.com/zulip/zulip.git
|
2017-11-23 20:21:57 +01:00
|
|
|
```
|
|
|
|
|
|
|
|
Finally, confirm that the new remote repository, upstream, has been configured:
|
|
|
|
|
2021-08-20 07:09:04 +02:00
|
|
|
```console
|
2017-11-23 20:21:57 +01:00
|
|
|
$ git remote -v
|
|
|
|
origin git@github.com:YOUR_USERNAME/zulip.git (fetch)
|
|
|
|
origin git@github.com:YOUR_USERNAME/zulip.git (push)
|
|
|
|
upstream https://github.com/zulip/zulip.git (fetch)
|
|
|
|
upstream https://github.com/zulip/zulip.git (push)
|
|
|
|
```
|
|
|
|
|
|
|
|
## Step 2: Set up the Zulip development environment
|
|
|
|
|
|
|
|
If you haven't already, now is a good time to install the Zulip development environment
|
|
|
|
([overview][zulip-rtd-dev-overview]). If you're new to working on Zulip or open
|
|
|
|
source projects in general, we recommend following our [detailed guide for
|
|
|
|
first-time contributors][zulip-rtd-dev-first-time].
|
|
|
|
|
2022-08-18 22:58:47 +02:00
|
|
|
If you are in the middle of installing the recommended setup on Windows 10,
|
2022-09-10 02:31:23 +02:00
|
|
|
you are ready to [continue with step 8](../development/setup-recommended.md#windows-10).
|
2022-08-18 22:58:47 +02:00
|
|
|
|
2018-12-10 17:12:58 +01:00
|
|
|
## Step 3: Configure continuous integration for your fork
|
2017-11-23 20:21:57 +01:00
|
|
|
|
|
|
|
This step is optional, but recommended.
|
|
|
|
|
2021-03-15 18:39:44 +01:00
|
|
|
The Zulip Server project is configured to use [GitHub Actions][github-actions]
|
2020-04-28 14:44:04 +02:00
|
|
|
to test and create builds upon each new commit and pull request.
|
2021-03-15 18:39:44 +01:00
|
|
|
GitHub Actions is the primary CI that runs frontend and backend
|
2020-04-28 14:44:04 +02:00
|
|
|
tests across a wide range of Ubuntu distributions.
|
|
|
|
|
2021-03-15 18:39:44 +01:00
|
|
|
GitHub Actions is free for open source projects and it's easy to
|
|
|
|
configure for your own fork of Zulip. After doing so, GitHub Actions
|
2020-04-28 14:44:04 +02:00
|
|
|
will run tests for new refs you push to GitHub and email you the outcome
|
2017-11-23 20:21:57 +01:00
|
|
|
(you can also view the results in the web interface).
|
|
|
|
|
2018-12-10 17:12:58 +01:00
|
|
|
Running CI against your fork can help save both your and the
|
2017-11-23 20:21:57 +01:00
|
|
|
Zulip maintainers time by making it easy to test a change fully before
|
2021-08-20 21:53:28 +02:00
|
|
|
submitting a pull request. We generally recommend a workflow where as
|
2017-11-23 20:21:57 +01:00
|
|
|
you make changes, you use a fast edit-refresh cycle running individual
|
2021-08-20 21:53:28 +02:00
|
|
|
tests locally until your changes work. But then once you've gotten
|
2017-11-23 20:21:57 +01:00
|
|
|
the tests you'd expect to be relevant to your changes working, push a
|
2021-03-15 18:39:44 +01:00
|
|
|
branch to run the full test suite in GitHub Actions before
|
2021-08-20 21:53:28 +02:00
|
|
|
you create a pull request. While you wait for GitHub Actions jobs
|
|
|
|
to run, you can start working on your next task. When the tests finish,
|
2018-12-10 17:12:58 +01:00
|
|
|
you can create a pull request that you already know passes the tests.
|
|
|
|
|
2021-03-15 18:39:44 +01:00
|
|
|
GitHub Actions will run all the jobs by default on your forked repository.
|
|
|
|
You can check the `Actions` tab of your repository to see the builds.
|
2018-12-10 17:12:58 +01:00
|
|
|
|
2017-11-23 20:21:57 +01:00
|
|
|
[gitbook-rebase]: https://git-scm.com/book/en/v2/Git-Branching-Rebasing
|
2019-02-26 02:49:09 +01:00
|
|
|
[github-help-add-ssh-key]: https://help.github.com/en/articles/adding-a-new-ssh-key-to-your-github-account
|
|
|
|
[github-help-conf-remote]: https://help.github.com/en/articles/configuring-a-remote-for-a-fork
|
|
|
|
[github-help-fork]: https://help.github.com/en/articles/fork-a-repo
|
|
|
|
[github-help-sync-fork]: https://help.github.com/en/articles/syncing-a-fork
|
2017-11-23 20:21:57 +01:00
|
|
|
[github-zulip]: https://github.com/zulip/
|
|
|
|
[github-zulip-zulip]: https://github.com/zulip/zulip/
|
2021-03-15 18:39:44 +01:00
|
|
|
[github-actions]: https://docs.github.com/en/actions
|
2022-09-10 02:31:23 +02:00
|
|
|
[zulip-rtd-dev-first-time]: ../development/setup-recommended.md
|
2019-09-30 19:37:56 +02:00
|
|
|
[zulip-rtd-dev-overview]: ../development/overview.md
|
2022-02-16 01:39:15 +01:00
|
|
|
[zulip-rtd-tools-setup]: zulip-tools.md#set-up-git-repo-script
|