docs: Clean up Git guide article on working copies.

* repo => repository for more standard language.
* Delete 3 repeats of explaining the origin/upstream/local.
* Add some links.
* Update `git pull` language for rebase changes.
This commit is contained in:
Tim Abbott 2021-04-01 10:16:26 -07:00
parent 08116a17b0
commit c768f7ae63
1 changed files with 20 additions and 22 deletions

View File

@ -1,15 +1,15 @@
# Working copies # Working copies
When you work on Zulip code, there are three working copies When you work on Zulip code, there are three copies of the Zulip Git
of the Zulip Git repo that you are generally concerned with: repository that you are generally concerned with:
- local copy: This lives on your laptop or your remote dev instance. - The `upstream` remote. This is the [official Zulip
- forked copy: This lives on GitHub, and it's tied to your account. repository](https://github.com/zulip/zulip) on GitHub. You probably
- official Zulip repo: This lives on the Zulip org on GitHub. Link [here](https://github.com/zulip/zulip). don't have write access to this repository.
- The **origin** remote: Your personal remote repository on GitHub.
We call the forked copy the **origin** remote. You'll use this to share your code and create [pull requests](../git/pull-requests.md).
- local copy: This lives on your laptop or your remote dev instance,
We call the official repo the **upstream** remote. and is what you'll use to make changes and create commits.
When you work on Zulip code, you will end up moving code between When you work on Zulip code, you will end up moving code between
the various working copies. the various working copies.
@ -18,8 +18,8 @@ the various working copies.
Sometimes you need to get commits. Here are some scenarios: Sometimes you need to get commits. Here are some scenarios:
- You may fork the official Zulip repo to your GitHub fork. - You may fork the official Zulip repository to your GitHub fork.
- You may fetch commits from the official Zulip repo to your local copy. - You may fetch commits from the official Zulip repository to your local copy.
- You occasionally may fetch commits from your forked copy. - You occasionally may fetch commits from your forked copy.
Sometimes you want to publish commits. Here are some scenarios: Sometimes you want to publish commits. Here are some scenarios:
@ -33,20 +33,18 @@ Finally, the Zulip core team will occasionally want your changes!
- The Zulip core team can accept your changes and add them to - The Zulip core team can accept your changes and add them to
the official repo, usually on the master branch. the official repo, usually on the master branch.
## 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 ## Relevant Git commands
The following commands are useful for moving commits between The following commands are useful for moving commits between
working copies: working copies:
- `git fetch`: This grabs code from another repo to your local copy. - `git fetch`: This grabs code from another repository to your local
- `git push`: This pushes code from your local repo to one of the remotes. 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.
- `git remote`: This helps you configure short names for remotes. - `git remote`: This helps you configure short names for remotes.
- `git pull`: This pulls code, but by default creates a merge commit. **Do not use this, please**! - `git pull`: This pulls code, but by default creates a merge commit
(which you definitely don't want). However, if you've followed our
[cloning documentation](../git/cloning.md), this will do `git pull
--rebase` instead, which is the only mode you'll want to use when
working on Zulip.