How to open an issue to make an Elasticsearch doc change, craft the change to your local copy, push it to your GitHub fork, create a pull request, and merge it to the Elasticsearch project.
Prerequisites: A GitHub account and local repos. See instructions at doc guild: (https://wiki.elastic.co/display/DOC/How+we+doc) and the Elasticsearch team development process: (https://github.com/elastic/elasticsearch-team/blob/master/onboarding-and-how-we-work/development_process.md#prepare-your-development-environment)
Open new issue
If the change has not yet been added as a GitHub issue, open a new issue.
- Go to the list of Elasticsearch issues on GitHub. (www.github.com/elastic/elasticsearch/issues)
- Click New Issue.
- Give the issue a pithy but descriptive title using Docs: as a prefix.
- Select Assignees, often yourself.
- Select Labels.
> Note that the :Docs label is for document infrastructure – and an area label appropriate to the feature.
- Clear the boilerplate text in the body of the issue.
- Begin the issue text with a link to the Elastic guide document you will change (www.elastic.co/guide).
- Quote the text to be changed.
- Click Submit new issue.
- Save the five digit issue number. Reference it on the commit and pull request to tie it to this issue.
Edit doc on local repo
Open the document to be changed on your local Elasticsearch repo to make the desired changes.
- At a terminal prompt, use the cd command to go to your copy of the Elasticsearch repo.
> To see your repo and fork, use the command
git remote -v
> If you are not in the correct branch, use the command git checkout.
git checkout master
- To ensure your repo is up to date, use the git pull command.
git pull origin masterOrigin is the default name for the remote. If you’ve given it another name, use that.
2.5 Create pull request branch.
git checkout -b kat257-slicingsupport-26114
- In a text editor, open the doc to be changed. Use the URL structure as a guide to find the document in the repo.
- Edit the doc, retaining or recreating any links or anchors in the text. See Asciidoc cheatsheet: (https://powerman.name/doc/asciidoc)
- Save your edits.
- At a terminal prompt:
docbldes --open. The reference will appear – after a short wait – in a web page.
- Verify changed text and links.
- Close reference in terminal using ^C.
Commit changes locally
- At a terminal prompt, use the command git commit. This opens COMMIT_EDITMSG in the terminal window.
git commit -a
To commit only the selected file, use the full path and file name instead of -a.
> You can also configure your terminal to use a text editor.
> In some cases, you might squash and merge before sending your commit to GitHub.
- Verify the changes are correct.
- file name of changed file
- Write commit message at the top of COMMIT_EDITMSG.
Begin message with [DOCS]. Write a brief account of the changes. At the end, add Closes #00000using the issue number you saved when opening a new issue.
For example: [DOCS] Edited intro sentence for clarity. Closes #39865
- See the commit using
Rebase from Elasticsearch repo
- To roll your commit on top of the Elasticsearch repo, use the rebase command.
git pull --rebase origin master
> To see diagrams of rebasing and understand why you want it, see (https://git-scm.com/book/en/v2/Git-Branching-Rebasing).
Push to branch on your fork
Copy the change you’ve made from your local repo to the appropriate branch on your GitHub fork of the Elasticsearch repo.
git push kat257 master
Create pull request
- Go to the Elasticsearch repo on your GitHub fork.
For example: (https://github.com/kat257/elasticsearch)
- Click Pull request link. The link is on the right under Clone or download.
A list of changed files will be displayed. At the top, you’ll see which base and head repository are compared.
- Click Create pull request.
The commit message you wrote will appear as the title for this pull request.
- In the request body, delete boilerplate. Add additional description ONLY if the change is complex or you are tagging others.
- Assign reviewers.
- Select the same labels as when creating the issue.
- Scroll to verify the diff between documents.
- Click Create pull request.
The result will display that you have requested a review, and begin running build checks, including a CLA verification.
> If you fail the CLA check, you may need to modify your git profile /gitconfig to add your name and email address, then update the pull request.
Merge to Elasticsearch
Once your review has been completed and your pull request approved, the doc will be ready to merge with the Elasticsearch repo.
- When approvals are complete, return to the pull request from your fork.
- Verify that CI checks are complete.
- Click Squash and merge.
- Click Confirm squash and merge. A notification Pull request closed displays.
Backport change to other branches
Backport these changes to other relevant branches, e.g., 7.x, 6.7.
For a different view of cherry picking, see here: Git and other commands cheatsheet#Cherrypickcommits
Generally, backport only to branches that do not require conflict resolution to merge, and no end-of-life branches. See Elastic Support Matrix.
- From your local repo, update metadata from the remote using git pull. (This will throw an error message after
git reset --hardin repetitive backports.)
- Create a custom named branch locally, for example, 7.x.
git checkout -b mk-issue#-newstuff-to-7.x
- Replace the content of the newly created branch with the remote branch using
git reset --hard. git reset --hard origin/7.x
- Begin backport using the cherry-pick command, e.g.,
git cherry-pick <commit ID>to commit changes to the new local branch. (Copy commit ID from the pull request, or, while still in the pull request branch, use
git log. ^C to quit the log.)
- Push change to your fork, e.g.,
git push kat257. (Add branch name to commit only that branch.)
- On your GitHub fork, click Compare & pull request to backport the branch.
- Verify that the base repo and head repo branch are the same.
- Delete boilerplate, then select reviewers and labels as before, adding the backport label.
- Click Create pull request. GitHub will indicate that you’ve requested a review, and begin running build checks.
- Once build checks are run and approvals are complete, click Squash and merge.