<?xml version="1.0" encoding="UTF-8"?>

<document xmlns="http://maven.apache.org/XDOC/2.0"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://maven.apache.org/XDOC/2.0 http://maven.apache.org/xsd/xdoc-2.0.xsd">

  <head>
    <title>Beginning Development</title>
    <script type="text/javascript"
            src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"/>
    <script type="text/javascript" src="js/anchors.js"/>
    <script type="text/javascript" src="js/google-analytics.js"/>
    <link rel="icon" href="images/favicon.png" type="image/x-icon" />
    <link rel="shortcut icon" href="images/favicon.ico" type="image/ico" />
  </head>

  <body>
    <section name="Content">
      <macro name="toc">
        <param name="fromDepth" value="1"/>
        <param name="toDepth" value="1"/>
      </macro>
    </section>
    <section name="Before development">
      <p>
        1. Ensure that Git, Java JDK >= 1.8 are installed.<br/>
        You can find information about development environment preparation here:
        <a href="https://github.com/sevntu-checkstyle/sevntu.checkstyle/wiki/Prepare-Development-Environment-in-Ubuntu-12.04">
        Prepare development environment in Ubuntu</a>.<br/>
        2. Fork your copy from Checkstyle main project. As it is described
        <a href="https://help.github.com/articles/fork-a-repo/"> here</a><br/>
        3. Checkout the current source code from: https://github.com/you_user_name/checkstyle/<br/>
        by running
      </p>
      <div class="wrap-content">
        <source>
            git clone git@github.com:you_user_name/checkstyle.git
        </source>
      </div>
    </section>

    <section name="Starting Development">
      <p>
        Here you can find instructions of importing and debugging the project for IDEs:<br/>
        <a href="eclipse.html">Eclipse IDE</a><br/>
        <a href="netbeans.html">NetBeans IDE</a><br/>
        <a href="idea.html">IntelliJ IDEA IDE</a><br/>
      </p>

      <p>
        Follow these instructions of Git usage and creating a Pull Request:<br/>
           1) Configure remotes:
      </p>
      <div class="wrap-content">
        <source>
          git remote add main https://github.com/checkstyle/checkstyle
        </source>
      </div>
      <p>
           2) Create a branch for a new check:
      </p>
      <div class="wrap-content">
        <source>
          git checkout -b my-new-check
        </source>
      </div>
      <p>
           3) Commit changes to my-new-check branch:
      </p>
      <div class="wrap-content">
        <source>
          git add .
          git commit -m "commit message"
        </source>
      </div>
      <p>
           4) Push branch to GitHub, to allow your mentor to review your code:
      </p>
      <div class="wrap-content">
        <source>
          git push origin my-new-check
        </source>
      </div>
      <p>
           5) Repeat steps 3-4 till development is complete<br/>
           All additional commits, please <a href="https://davidwalsh.name/squash-commits-git">
           squash to first</a>. Please read all rules for PullRequest at
           our <a href="https://github.com/checkstyle/checkstyle/wiki/PR-rules">wiki</a>.
      </p>
      <div class="wrap-content">
        <source>
          git rebase -i master
          git push --force origin my-new-check
        </source>
      </div>
      <p>
           6) Update current branch and local master by pulling changes that were done<br/>
           by other contributors:
      </p>
      <div class="wrap-content">
        <source>
          git pull main master
          git push origin master
        </source>
      </div>
      <p>
           7) Rebase your branch over your updated master
      </p>
      <div class="wrap-content">
        <source>
          git rebase master
        </source>
      </div>
      <p>
           8) In the process of the rebase, it may discover conflicts.<br/>
           In that case it will stop and allow you to fix the conflicts.<br/>
           After fixing conflicts, use git add . to update the index with those contents,<br/>
           and then just run:
      </p>
      <div class="wrap-content">
        <source>
          git rebase --continue
        </source>
      </div>
      <p>
           9) Push branch to GitHub (with all your final changes and actual code of Checkstyle):
      </p>
      <div class="wrap-content">
        <source>
          git push --force origin my-new-check
        </source>
      </div>
      <p>
           10) Only after all content is finished and testing is done - send a
          <a href="https://help.github.com/articles/using-pull-requests/">Pull Request</a>
      </p>
    </section>
  </body>
</document>
