4

I have made my first contribute to a project on GitHub. I have selected the file to edit, created a pull request, and made my edits. Then I noticed a mistake, selected the file again, and made my corrections. I always worked online, no command line. Now a contributor od the project asked me to squash my two commits. The question is: how?

3
  • stackoverflow.com/questions/14534397/…
    – vidit
    Commented Nov 27, 2015 at 17:24
  • I doubt that you can. GitHub's online editing facilities are pretty basic, and aren't anything close to a complete Git client. You will probably have to do this offline.
    – Chris
    Commented Nov 27, 2015 at 19:26
  • Ok I will try from the command line. But how can I "move" from the online editor to the command line?
    – Andrea
    Commented Nov 28, 2015 at 7:07

1 Answer 1

1

But how can I "move" from the online editor to the command line?

See Modifying an active pull request locally in GitHub's documentation:

  1. In any repository's right sidebar, click Pull Requests.
  2. In the "Pull Requests" list, click the pull request you'd like to merge.
  3. At the bottom of the pull request, click command line. Follow the sequence of steps to bring down the proposed pull request.

Then modify the branch locally.

In this case you'll want to squash the commits using git rebase --interactive <commit-before-yours>. Choose to pick your first commit and squash your second one.

Finally, push it back to the existing PR branch on GitHub. In this case you'll have to use --force since you're replacing your old commits with a new one.

Not the answer you're looking for? Browse other questions tagged or ask your own question.