2017-06-21 21:06:09 +02:00
|
|
|
# Working copies
|
2017-06-21 21:01:10 +02:00
|
|
|
|
2021-04-01 19:16:26 +02:00
|
|
|
When you work on Zulip code, there are three copies of the Zulip Git
|
|
|
|
repository that you are generally concerned with:
|
2017-06-21 21:01:10 +02:00
|
|
|
|
2021-08-20 21:53:28 +02:00
|
|
|
- The `upstream` remote. This is the [official Zulip
|
|
|
|
repository](https://github.com/zulip/zulip) on GitHub. You probably
|
2021-04-01 19:16:26 +02:00
|
|
|
don't have write access to this repository.
|
|
|
|
- The **origin** remote: Your personal remote repository on GitHub.
|
2022-02-24 00:17:21 +01:00
|
|
|
You'll use this to share your code and create [pull requests](pull-requests.md).
|
2021-04-01 19:16:26 +02:00
|
|
|
- local copy: This lives on your laptop or your remote dev instance,
|
|
|
|
and is what you'll use to make changes and create commits.
|
2017-06-21 21:01:10 +02:00
|
|
|
|
|
|
|
When you work on Zulip code, you will end up moving code between
|
|
|
|
the various working copies.
|
|
|
|
|
|
|
|
## Workflows
|
|
|
|
|
2017-11-26 15:03:13 +01:00
|
|
|
Sometimes you need to get commits. Here are some scenarios:
|
2017-06-21 21:01:10 +02:00
|
|
|
|
2021-04-01 19:16:26 +02:00
|
|
|
- You may fork the official Zulip repository to your GitHub fork.
|
|
|
|
- You may fetch commits from the official Zulip repository to your local copy.
|
2017-06-21 21:01:10 +02:00
|
|
|
- You occasionally may fetch commits from your forked copy.
|
|
|
|
|
2017-11-26 15:03:13 +01:00
|
|
|
Sometimes you want to publish commits. Here are some scenarios:
|
2017-06-21 21:01:10 +02:00
|
|
|
|
2017-11-26 15:03:13 +01:00
|
|
|
- You push code from your local copy to your GitHub fork. (You usually
|
2017-06-21 21:01:10 +02:00
|
|
|
want to put the commit on a feature branch.)
|
|
|
|
- You submit a PR to the official Zulip repo.
|
|
|
|
|
|
|
|
Finally, the Zulip core team will occasionally want your changes!
|
|
|
|
|
|
|
|
- The Zulip core team can accept your changes and add them to
|
2021-09-01 03:13:20 +02:00
|
|
|
the official repo, usually on the `main` branch.
|
2017-06-16 16:03:51 +02:00
|
|
|
|
2020-08-11 01:47:54 +02:00
|
|
|
## Relevant Git commands
|
2017-06-21 21:01:10 +02:00
|
|
|
|
|
|
|
The following commands are useful for moving commits between
|
|
|
|
working copies:
|
|
|
|
|
2021-04-01 19:16:26 +02:00
|
|
|
- `git fetch`: This grabs code from another repository to your local
|
|
|
|
copy. (Defaults to fetching from your default remote, `origin`).
|
|
|
|
- `git fetch upstream`: This grabs code from the upstream repository to your local copy.
|
|
|
|
- `git push`: This pushes code from your local repository to one of the remotes.
|
2017-06-21 21:06:09 +02:00
|
|
|
- `git remote`: This helps you configure short names for remotes.
|
2021-04-01 19:16:26 +02:00
|
|
|
- `git pull`: This pulls code, but by default creates a merge commit
|
2021-08-20 21:53:28 +02:00
|
|
|
(which you definitely don't want). However, if you've followed our
|
2022-02-24 00:17:21 +01:00
|
|
|
[cloning documentation](cloning.md), this will do
|
2021-09-08 00:23:24 +02:00
|
|
|
`git pull --rebase` instead, which is the only mode you'll want to
|
|
|
|
use when working on Zulip.
|