Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>You can rewrite your history if you so desire, but it is a bad idea if anyone else has copies of the history. In this case, you would probably use interactive rebase: <code>git rebase -i master topic</code>. This will give you a list of commits from master to topic, with hints about how to play with them. You'd just need to remove the line containing the commit you want to remove.</p> <p>That said, I must emphasize that it is irresponsible to do this if anyone else has this history. You would have to force-push it to your central repo, and everyone else would have to fix their repositories to match, can be relatively simple or complex depending on circumstances.</p> <p>There's a nice section called "recovering from upstream rebase" in the <a href="http://git-scm.com/docs/git-rebase" rel="nofollow noreferrer">git-rebase man page</a> discussing how to deal with this, if you really decide to.</p> <p>Edit:</p> <p>For simple history, a common scenario would be, after forcing a non-fastforward push to the central repo (<code>push -f</code>), other developers:</p> <ul> <li>back up their old master: <code>git branch -m master master_old</code></li> <li>get updates and recreate master from origin: <code>git remote update origin; git branch master origin/master</code></li> <li>rebase all topic branches onto new master: <code>git rebase --onto master master_old topic</code></li> </ul> <p>If they have work in <em>their</em> master branch which is not in origin yet, they'll have to get fancier, rebasing this work and all topic branches onto the new position of master... this should give you an idea why it's so awful to rewrite history that other people have. Really, once something's passed into the public repository, you should regard it as hard-and-fast recorded history, not a work in progress.</p>
 

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