|
1 | 1 | # Git commands for creating a new article or updating an existing article |
2 | | -This article explains how to use the Git comamnds from the command-line to make changes to SQL Server documentation on github. If you have not setup a github account, permissions, and tools, see how to [Install and set up tools for authoring in GitHub](tools-and-setup.md). |
3 | | - |
4 | | -## Standard process (working from master) |
5 | | -Follow the steps in this article to create a local working branch on your computer so that you can create or update articles in the SQL Server documentation on github. |
6 | | - |
7 | | -1. Start Git Bash (or the command-line tool you use for Git). |
8 | | - |
9 | | - > **Note:** If you are working in the public repository, change **sql-docs-pr** to **sql-docs** in all the commands. |
10 | | -
|
11 | | -2. Change to sql-docs-pr: |
12 | | - |
13 | | - cd sql-docs-pr |
14 | | - |
15 | | -3. Check out the master branch: |
16 | | - |
17 | | - git checkout master |
18 | | - |
19 | | -4. Create a fresh local working branch derived from the master branch: |
20 | | - |
21 | | - git pull upstream master:<working branch> |
22 | | - |
23 | | -5. Move into the new working branch: |
24 | | - |
25 | | - git checkout <working branch> |
26 | | - |
27 | | -6. Let your fork know you created the local working branch: |
28 | | - |
29 | | - git push origin <working branch> |
30 | | - |
31 | | -7. Create your new article or make changes to an existing article. Use Windows Explorer to open and create new markdown files, and use a markdown editor (for example, Atom (http://atom.io) or Visual Studio Code). After you have created or modified your article and images, go to the next step. |
32 | | - |
33 | | -8. Add and commit the changes you made: |
34 | | - |
35 | | - git add . |
36 | | - git commit –m "<comment>" |
37 | | - |
38 | | - Or, to add only the specific files you modified: |
39 | | - |
40 | | - git add <file path> |
41 | | - git commit –m "<comment>" |
42 | | - |
43 | | - If you deleted files, you have to use this: |
44 | | - |
45 | | - git add --all |
46 | | - git commit -m "<comment>" |
47 | | - |
48 | | -9. Update your local working branch with changes from upstream: |
49 | | - |
50 | | - git pull upstream master |
51 | | - |
52 | | -10. Push the changes to your fork on GitHub: |
53 | | - |
54 | | - git push origin <working branch> |
55 | | - |
56 | | -12. When you are ready to submit your content to the upstream master branch for staging, validation, and/or publishing, you must create a pull request. Go to the public, [sql-docs](https://github.com/Microsoft/sql-docs), or private, [sql-docs-pr](https://github.com/Microsoft/sql-docs-pr), repository and look for the green button to create a pull request for your recent changes. Click that button, and then click **Create pull request** to start the pull request. |
57 | | - |
58 | | -## Pull requests |
59 | | -1. When you create a pull request in the github UI, it immediately takes you to the pull request window. |
60 | | - |
61 | | -  |
62 | | - |
63 | | -2. After several minutes, you should see a link to a staged version of your topic with the changes you made. |
64 | | - |
65 | | -3. If you need to make further edits, make the changes on your local machine. Then repeat the add, commmit, and push origin steps. This is all in the same branch. Pushing the new commits will update the pull request and restage your content. |
66 | | - |
67 | | -## Sign-off |
68 | | -When you are ready to publish your changes, type **#sign-off** in the comment window of your pull request. Click the **Comment** button. Your request will be reviewed and merged. |
69 | 2 |
|
70 | 3 | > [!NOTE] |
71 | | -> If you are working in the private repository, after you sign off your changes are merged and published to the staging site. |
72 | | -
|
73 | | -## Troubleshooting |
74 | | - |
75 | | -If you are having problems accessing the repository on github, make sure you have followed the github account and permissions steps in the [tools and setup](tools-and-setup.md) guide. |
76 | | - |
77 | | -If you get a **all checks have failed** error in the pull request window, you must [log onto the OPS portal](tools-and-setup.md#log-onto-the-ops-portal) as is described in the tools and setup guide. |
78 | | - |
79 | | - |
80 | | - |
81 | | -## Working with release branches |
82 | | - |
83 | | -When you are working with a release branch, the best way to create a local working branch from the release branch is to use this command syntax: |
84 | | - |
85 | | - git checkout upstream/<upstream branch name> -b <local working branch name> |
86 | | - |
87 | | -This creates the local branch directly from the upstream branch, avoiding any local merging. |
| 4 | +> This guide has been moved to a new location. |
| 5 | +> For the latest guides, go to the [SQL docs contributor share](https://aka.ms/sqldocswiki). |
0 commit comments