title: git - made a push to the wrong repository, how to remove?
body: <p>Edit: Regarding <strong>This question may already have an answer here:</strong>, note that the title of that question refers to undoing a commit, not a push. I don't think SO should be reinforcing the frequent confusion between the two within git. Also is a question with 22 different answers going to be the best reference?</p>
  <p>I created a new project <code>lambda</code> in a repository X, under the dev branch, then did <code>git add</code>, <code>git commit</code> and <code>git push</code>.</p>
  <p>Turns out it doesn't belong in that repository, but in repository Y, under its dev branch. Now people looking at X are seeing a bunch of stuff that doesn't belong.</p>
  <p>How do I remove that push from X dev? Note that I don't want to remove the whole branch from X, just the bad push I did.</p>
  <p>If it helps, everything is self contained in that project, no other projects were altered. Just deleting lambda project and any history of it would be okay too.</p>
  <p>After searching, I think what I want to do is <a href="https://stackoverflow.com/questions/1270514/undoing-a-git-push">undo a git push</a>. But I'm not sure I understand the solution.</p>
  <h2>git log</h2>
  <p>This is what <code>git log</code> is telling me.</p>
  <pre><code>$ git log
  commit 0c9ac8b157222995d3414b84e7ce1b3e1adf5560
  Author: Clueless &lt;clueless@initech.com&gt;
  Date:   Fri Feb 14 10:01:38 2014 -0400
  
  Initial commit of lambda.
  
  commit bdd142c778f0c43141cf48d60e4ee0bef018e1c0
  Author: Not Clueless &lt;notclueless@initech.com&gt;
  Date:   Thu Feb 13 12:50:39 2014 -0400
  
  update red with latest and greatest
  
  commit f1047816fa7b201de7f798e6026b8b29a1bf8f75
  Author: Also Not Clueless &lt;alsonotclueless@initech.com&gt;
  Date:   Wed Feb 5 15:48:07 2014 -0400
  
  update green with latest and greatest
  
  etc...
  </code></pre>
  <p>So do I want to use?</p>
  <pre><code>git push -f origin 0c9ac8...:&lt;???&gt;
  </code></pre>
  <p>But don't I want to make <code>bdd142...</code> be the origin? Also what do I specify for ??? ?</p>
  <h2>Diagrams</h2>
  <p>Perhaps a couple of diagrams might help:</p>
  <p>What it looks like now:</p>
  <pre><code>X-repo
  +---master-branch
  |
  +---dev-branch---+---red-project
  |                |
  |                +---green-project
  |                |
  |                +---blue-project
  |                |
  |                +---lambda-project &lt;-- doesn't belong
  |
  +---other-branches
  
  Y-repo
  +---master-branch
  |
  +---dev-branch---+---alpha-project
                   |
                   +---beta-project
                   |
                   +---gamma-project
  </code></pre>
  <p>What it should look like:</p>
  <pre><code>X-repo
  +---master-branch
  |
  +---dev-branch---+---red-project
  |                |
  |                +---green-project
  |                |
  |                +---blue-project
  |
  +---other-branches
  
  Y-repo
  +---master-branch
  |
  +---dev-branch---+---alpha-project
                   |
                   +---beta-project
                   |
                   +---gamma-project
                   |
                   +---lambda-project &lt;-- belongs here
  </code></pre>