Skip to main content
The 2024 Developer Survey results are live! See the results

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

11
  • 57
    Alternative solution #1: orphan branches - rocks!
    – Thomas
    Commented May 9, 2016 at 15:51
  • 14
    Alternative solution #1 FTW. Just to add, if you want to push your changes to the remote, do git push origin master --force. Commented Sep 9, 2016 at 11:01
  • 3
    should not forget git push --force
    – NecipAllef
    Commented Mar 28, 2018 at 16:38
  • 2
    Don't do an orphan branch on code (i.e. don't do alternative solution #1 above) if you're about to push to an open Github pull request!!! Github will close your PR because the current head isn't a descendant of the stored head sha. Commented Mar 29, 2019 at 0:54
  • 1
    Alternative solution #1 also avoids the merge conflicts that can occur when squashing commits
    – FernAndr
    Commented May 13, 2020 at 15:54