846 links
  • Links Lounge
  • Home
  • Login
  • RSS Feed
  • Tag cloud
  • Picture wall
  • Daily
Links per page: 20 50 100
page 1 / 1
  • Oh, shit, git! - via Seb Sauvage

    Something wrong

    git reflog
    # you will see a list of every thing you've done in git, across all branches!
    # each one has an index HEAD@{index}
    # find the one before you broke everything
    git reset HEAD@{index}
    # magic time machine

    I accidentally committed to the wrong branch!

    # undo the last commit, but leave the changes available
    git reset HEAD~ --soft
    git stash
    # move to the correct branch
    git checkout name-of-the-correct-branch
    git stash pop
    git add . # or add individual files
    git commit -m "your message here"
    # now your changes are on the correct branch

    Oui, quelqu'un paie un nom de domaine chaque année pour ça. Merci quand même :-)

    Mon 12 Sep 2016 01:45:17 PM CEST - permalink -
    - - - http://ohshitgit.com/
    CommandLine Git
Links per page: 20 50 100
page 1 / 1
Shaarli - The personal, minimalist, super-fast, no-database delicious clone by the Shaarli community - Help/documentation