Oh Shit, Git

#52 · 🔥 379 · 💬 230 · one year ago · ohshitgit.com · layer8 · 📷
Or add individual files git commit -amend -no-edit # now your last commit contains that change! # WARNING: never amend public commits. Git commit -amend # follow prompts to change the commit message. 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. Git checkout name-of-the-correct-branch # grab the last commit to master git cherry-pick master # delete it from master git checkout master git reset HEAD~ -hard. File under /¯. # find the commit you need to undo git log # use the arrow keys to scroll up and down in history # once you've found your commit, save the hash git revert [saved hash] # git will create a new commit that undoes that commit # follow prompts to edit the commit message # or just save and commit. You can also revert a single file instead of a full commit! But of course, in true git fashion, it's a completely different set of fucking commands.... # find a hash for a commit before the file was changed git log # use the arrow keys to scroll up and down in history # once you've found your commit, save the hash git checkout [saved hash] - path/to/file # the old version of the file will be in your index git commit -m "Wow, you don't have to copy-paste to undo". Get the lastest state of origin git fetch origin git checkout master git reset -hard origin/master # delete untracked files and directories git clean -d -force # repeat checkout/reset/clean for each borked branch.
Oh Shit, Git



Send Feedback | WebAssembly Version (beta)