github.com/ld86/docker@v1.7.1-rc3/docs/project/work-issue.md (about)

     1  <!--[metadata]>
     2  +++
     3  title = "Work on your issue"
     4  description = "Basic workflow for Docker contributions"
     5  keywords = ["contribute, pull request, review, workflow, beginner, squash,  commit"]
     6  [menu.main]
     7  parent = "smn_contribute"
     8  weight=3
     9  +++
    10  <![end-metadata]-->
    11  
    12  
    13  # Work on your issue
    14  
    15  The work you do for your issue depends on the specific issue you picked.
    16  This section gives you a step-by-step workflow. Where appropriate, it provides
    17  command examples. 
    18  
    19  However, this is a generalized workflow, depending on your issue you may repeat
    20  steps or even skip some. How much time the work takes depends on you --- you
    21  could spend days or 30 minutes of your time.
    22  
    23  ## How to work on your local branch
    24  
    25  Follow this workflow as you work:
    26  
    27  1. Review the appropriate style guide.
    28  
    29      If you are changing code, review the <a href="../coding-style"
    30      target="_blank">coding style guide</a>. Changing documentation? Review the
    31      <a href="../doc-style" target="_blank">documentation style guide</a>. 
    32  	
    33  2. Make changes in your feature branch.
    34  
    35      Your feature branch you created in the last section. Here you use the
    36      development container. If you are making a code change, you can mount your
    37      source into a development container and iterate that way. For documentation
    38      alone, you can work on your local host. 
    39  
    40      Make sure you don't change files in the `vendor` directory and its
    41      subdirectories; they contain third-party dependency code. Review <a
    42      href="../set-up-dev-env" target="_blank">if you forgot the details of
    43      working with a container</a>.
    44  
    45  
    46  3. Test your changes as you work.
    47  
    48      If you have followed along with the guide, you know the `make test` target
    49      runs the entire test suite and `make docs` builds the documentation. If you
    50      forgot the other test targets, see the documentation for <a
    51      href="../test-and-docs" target="_blank">testing both code and
    52      documentation</a>.  
    53  	
    54  4. For code changes, add unit tests if appropriate.
    55  
    56      If you add new functionality or change existing functionality, you should
    57      add a unit test also. Use the existing test files for inspiration. Aren't
    58      sure if you need tests? Skip this step; you can add them later in the
    59      process if necessary.
    60  	
    61  5. Format your source files correctly.
    62  
    63      <table>
    64        <thead>
    65        <tr>
    66          <th>File type</th>
    67          <th>How to format</th>
    68        </tr>
    69        </thead>
    70        <tbody>
    71        <tr>
    72          <td><code>.go</code></td>
    73          <td>
    74              <p>
    75              Format <code>.go</code> files using the <code>gofmt</code> command.
    76              For example, if you edited the `docker.go` file you would format the file
    77              like this:
    78              </p>
    79              <p><code>$ gofmt -s -w docker.go</code></p>
    80              <p>
    81              Most file editors have a plugin to format for you. Check your editor's
    82              documentation.
    83              </p>
    84          </td>
    85        </tr>
    86        <tr>
    87          <td style="white-space: nowrap"><code>.md</code> and non-<code>.go</code> files</td>
    88          <td>Wrap lines to 80 characters.</td>
    89        </tr>
    90        </tbody>
    91      </table>
    92  
    93  6. List your changes.
    94  
    95          $ git status
    96          On branch 11038-fix-rhel-link
    97          Changes not staged for commit:
    98            (use "git add <file>..." to update what will be committed)
    99            (use "git checkout -- <file>..." to discard changes in working directory)
   100  
   101          modified:   docs/installation/mac.md
   102          modified:   docs/installation/rhel.md
   103  
   104      The `status` command lists what changed in the repository. Make sure you see
   105      the changes you expect.
   106  
   107  7. Add your change to Git.
   108  
   109          $ git add docs/installation/mac.md
   110          $ git add docs/installation/rhel.md
   111  
   112  
   113  8. Commit your changes making sure you use the `-s` flag to sign your work.
   114  
   115          $ git commit -s -m "Fixing RHEL link"
   116  
   117  9. Push your change to your repository.
   118  
   119          $ git push origin 11038-fix-rhel-link
   120          Username for 'https://github.com': moxiegirl
   121          Password for 'https://moxiegirl@github.com': 
   122          Counting objects: 60, done.
   123          Compressing objects: 100% (7/7), done.
   124          Writing objects: 100% (7/7), 582 bytes | 0 bytes/s, done.
   125          Total 7 (delta 6), reused 0 (delta 0)
   126          To https://github.com/moxiegirl/docker.git
   127           * [new branch]      11038-fix-rhel-link -> 11038-fix-rhel-link
   128          Branch 11038-fix-rhel-link set up to track remote branch 11038-fix-rhel-link from origin.
   129  
   130  ## Review your branch on GitHub
   131  
   132  After you push a new branch, you should verify it on GitHub:
   133  
   134  1. Open your browser to <a href="https://github.com" target="_blank">GitHub</a>.
   135  
   136  2. Go to your Docker fork.
   137  
   138  3. Select your branch from the dropdown.
   139  
   140  	![Find branch](/project/images/locate_branch.png)
   141  	
   142  4. Use the "Compare" button to compare the differences between your branch and master.
   143  
   144  	 Depending how long you've been working on your branch, your branch maybe
   145  	 behind Docker's upstream repository. 
   146  	 
   147  5. Review the commits.
   148  
   149  	 Make sure your branch only shows the work you've done.
   150  	 
   151  ## Pull and rebase frequently
   152  
   153  You should pull and rebase frequently as you work.  
   154  
   155  1. Return to the terminal on your local machine and checkout your
   156      feature branch in your local `docker-fork` repository.   
   157  
   158  2. Fetch any last minute changes from `docker/docker`.
   159  
   160          $ git fetch upstream master
   161          From github.com:docker/docker
   162           * branch            master     -> FETCH_HEAD
   163  
   164  3. Start an interactive rebase.
   165  
   166          $ git rebase -i upstream/master
   167  
   168  4. Rebase opens an editor with a list of commits.
   169  
   170          pick 1a79f55 Tweak some of the other text for grammar
   171          pick 53e4983 Fix a link
   172          pick 3ce07bb Add a new line about RHEL
   173  
   174  5. Replace the `pick` keyword with `squash` on all but the first commit.
   175  
   176          pick 1a79f55 Tweak some of the other text for grammar
   177          squash 53e4983 Fix a link
   178          squash 3ce07bb Add a new line about RHEL
   179  
   180      After you save the changes and quit from the editor, git starts
   181      the rebase, reporting the progress along the way. Sometimes
   182      your changes can conflict with the work of others. If git
   183      encounters a conflict, it stops the rebase, and prints guidance
   184      for how to correct the conflict.
   185  
   186  6. Edit and save your commit message.
   187  
   188          $ git commit -s
   189  
   190      Make sure your message includes <a href="../set-up-git" target="_blank">your signature</a>.
   191  
   192  7. Force push any changes to your fork on GitHub.
   193  
   194          $ git push -f origin 11038-fix-rhel-link
   195  
   196  
   197  ## Where to go next
   198  
   199  At this point, you should understand how to work on an issue. In the next
   200  section, you [learn how to make a pull request](/project/create-pr/).