-
Notifications
You must be signed in to change notification settings - Fork 880
Technical Editing for Angular Docs
You need to get local copies of the angular/angular and angular.io repos. Because you'll be making changes to angular.io, you first need to fork that repo.
After you have local copies of the repos, you'll need to change the configuration.
-
Go to https://github.com/angular/angular.io, and click the Fork button at the upper right.
This creates a repo at https://github.com/YOUR_ID/angular.io, where YOUR_ID is your GitHub ID. -
In a terminal window, create a directory to hold your clones of angular and angular.io. We'll call it
~/angular
, but you could use a different location.
mkdir ~/angular
- Clone the repos.
cd ~/angular
git clone https://github.com/angular/angular.git
git clone https://github.com/YOUR_ID/angular.io.git # YOUR-ID -> your GitHub ID
These commands create directories named angular
and angular.io
that hold
clones of the angular/angular and angular/angular.io repos, respectively.
From here on out, unless otherwise stated,
all instructions apply only to the angular.io
directory.
- Tell your angular.io clone about its grandparent, which we call upstream:
$ git remote add upstream [email protected]:angular/angular.io.git
- Create ssh keys: ssh-keygen -t rsa -C "[email protected]"
ssh-add ~/.ssh/id_rsa
pbcopy < ~/.ssh/id_rsa.pub
-
Paste your keys into GitHub, under SSH Keys for your account. [PENDING: test, flesh out these instructions]
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.31.2/install.sh | bash
-
Under the new angular.io directory, do the usual setup required to build the docs:
cd ~/angular/angular.io
nvm use 5
npm install
[PENDING: Check. Specifying nvm might not be necessary any more.]
MAYBE ALSO:
- Add aliases for
pr
andvoodoo
:
[alias]
# Add a GitHub pull request to your local repo and checkout
# Usage: git pr 123 (where 123 is the pull request number)
# Creates a new branch: pr-123 containing the contents of the pull request
# Replaces "git checkout upstream/pr/123 && git checkout -b pr-123"
pr = "!f() { git fetch upstream refs/pull/$1/head:pr-$1; git checkout pr-$1; } ; f"
# Do the "fetch upstream && rebase upstream master" dance
# Usage: git voodoo
voodoo = "!f() { git fetch upstream; git rebase upstream/master; } ; f"
Now that you're set up, you can view the docs, create your own pull requests, and review other people's pull requests.
From the top directory of the angular.io clone, run gulp check-deploy
:
cd ~/angular/angular.io
gulp check-deploy
TODO: Flesh this out
NOTE: This section is preliminary; we'll probably edit or delete it.
- Sync your local repo with the remote one.
git checkout master
git voodoo
git voodoo
is equivalent togit fetch upstream
followed bygit rebase upstream/master
.We probably overuse it in these instructions, but it's better to do it unnecessarily than to forget to do it. Note that
git status
, and perhaps other commands, will be confused until you do that voodoo for the first time.
- Get the pull request files. For example, if the pull request # is 123:
git pr 123
git pr
is equivalent togit checkout upstream/pr/123
followed bygit checkout -b pr-123
.
- If necessary, squash commits.
git rebase -i upstream/master
(...pick the first change, and fixup the rest...)
- Make sure the commit message follows the commit message guidelines and perhaps reflects messages for similar pull requests. Almost always the commit message's last line should be "closes #123"; that will close the PR and add links between the PR and this commit.
You can change the commit message with this command:
git commit -c pr-123 --amend
Here's an example of a commit message:
docs(samples): add Dart version of pipes example
closes #123
- Fetch and rebase master.
git voodoo
- Make sure your branch has the commits you expect for that PR!
git log -v -n 3
n is optional; limits the number of commits displayed
Should see the pr commit(s) followed by the top prior commits on master.
Stop and reconsider if you see anything else ... or if you forgot to
add the closes #123
.
- Make sure your changes didn't break the site:
gulp check-deploy
- Push the change.
git push upstream pr-123:master
- Clean up.
git checkout master
git voodoo
git branch -D pr-123
- Go to https://github.com/angular/angular.io/pulls and confirm that the PR is closed (it is no longer listed).
If it is still open—most likely because you omitted "closes #123"—close the PR now with a comment linking back to this commit.