2017-06-21 21:06:09 +02:00
|
|
|
# Working copies
|
2017-06-21 21:01:10 +02:00
|
|
|
|
|
|
|
When you work on Zulip code, there are three working copies
|
|
|
|
of the Zulip git repo that you are generally concerned with:
|
|
|
|
|
2017-11-26 15:03:13 +01:00
|
|
|
- local copy: This lives on your laptop or your remote dev instance.
|
2017-06-21 21:01:10 +02:00
|
|
|
- forked copy: This lives on GitHub, and it's tied to your account.
|
2017-11-26 15:03:13 +01:00
|
|
|
- official Zulip repo: This lives on the Zulip org on GitHub. Link [here](https://github.com/zulip/zulip).
|
2017-06-21 21:01:10 +02:00
|
|
|
|
2017-11-26 15:03:13 +01:00
|
|
|
We call the forked copy the **origin** remote.
|
2017-06-21 21:01:10 +02:00
|
|
|
|
2017-11-26 15:03:13 +01:00
|
|
|
We call the official repo the **upstream** remote.
|
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
|
|
|
|
2017-06-16 16:03:51 +02:00
|
|
|
- You may fork the official Zulip repo to your GitHub fork.
|
2017-11-09 16:26:38 +01:00
|
|
|
- You may fetch commits from the official Zulip repo 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
|
|
|
|
the official repo, usually on the master branch.
|
2017-06-16 16:03:51 +02:00
|
|
|
|
2017-06-21 21:01:10 +02:00
|
|
|
## Names
|
|
|
|
|
|
|
|
We call remote working copies of the repository by these short
|
|
|
|
names.
|
|
|
|
|
|
|
|
- **origin**: This is your fork.
|
|
|
|
- **upstream**: This is the official Zulip repo.
|
|
|
|
|
|
|
|
## Relevant git commands
|
|
|
|
|
|
|
|
The following commands are useful for moving commits between
|
|
|
|
working copies:
|
|
|
|
|
|
|
|
- `git fetch`: This grabs code from another repo to your local copy.
|
|
|
|
- `git push`: This pushes code from your local repo to one of the remotes.
|
2017-06-21 21:06:09 +02:00
|
|
|
- `git remote`: This helps you configure short names for remotes.
|
2017-11-26 15:03:13 +01:00
|
|
|
- `git pull`: This pulls code, but by default creates a merge commit. **Do not use this, please**!
|