Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <h2>To update a pull request</h2> <p>To update a pull request (point #1), the only thing you need to do is checkout the same branch the pull request is from and push to it again:</p> <pre><code>cd /my/fork git checkout master ... git commit -va -m "Correcting for PR comments" git push </code></pre> <h2>Optional - Cleaning commit history</h2> <p>You may be asked to squash your commits together so that the repository history is clean, or yourself want to remove intermediary commits which distract from "the message" in your pull request (point #2). For example if your commit history looks like this:</p> <pre><code>$ git remote add parent git@github.com:other-user/project.git $ git fetch parent $ git log --oneline parent/master..master e4e32b8 add test case as per PR comments eccaa56 code standard fixes as per PR comments fb30112 correct typos and fatal error 58ae094 fixing problem </code></pre> <p>It's a good idea to squash things together so they appear as a single commit:</p> <pre><code>$ git rebase -i parent/master </code></pre> <p>This will prompt you to choose how to rewrite the history of your pull request, the following will be in your editor:</p> <pre><code>pick 58ae094 fixing actual problem pick fb30112 correct typos pick eccaa56 code standard fixes pick e4e32b8 add test case as per PR comments </code></pre> <p>For any commit you want to be part of the previous commit - change pick to squash:</p> <pre><code>pick 58ae094 fixing actual problem squash fb30112 correct typos squash eccaa56 code standard fixes squash e4e32b8 add test case as per PR comments </code></pre> <p>And close your editor. Git will then rewrite the history and prompt you to provide a commit message for the one combined commit. Amend accordingly and your commit history will now be concise:</p> <pre><code>$ git log --oneline parent/master..master 9de3202 fixing actual problem </code></pre> <p>Push that to your fork:</p> <pre><code>$ git push -f Counting objects: 19, done. Delta compression using up to 4 threads. Compressing objects: 100% (5/5), done. Writing objects: 100% (11/11), 978 bytes, done. Total 11 (delta 9), reused 7 (delta 6) To git@github.com:me/my-fork.git f1238d0..9de3202 HEAD -&gt; master </code></pre> <p>and your pull request will contain a single commit, incorporating all changes previously split into several commits.</p> <h2>Changing history on public repos is a bad thing</h2> <p>Rewriting history and using <code>git push -f</code> on a branch that, potentially, someone else has already cloned is a bad thing - it causes the repository's history and that of the checkout to diverge.</p> <p>However, amending the history of your fork to correct the change you are <em>proposing</em> to be integrated into a repository - is a good thing. As such have no reservations squashing "noise" out of your pull requests.</p> <h2>A note on branches</h2> <p>In the above I show the pull request as having come from the <code>master</code> branch of your fork, there's nothing wrong with that necessarily but it does create certain limitations such as, if this is your standard technique, only being able to have one PR open per repository. It's a better idea though to create a branch for each individual change you wish to propose:</p> <pre><code>$ git branch feature/new-widgets $ git checkout feature/new-widgets ... Hack hack hack ... $ git push # Now create PR from feature/new-widgets </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload