github.com/jogo/docker@v1.7.0-rc1/docs/sources/project/work-issue.md (about)

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