Reset a Branch to Remote State with git
Every once in a while I accidentally hose my repository's master branch by merging or committing something I shouldn't. And then on rare occasion I push that to my remote and then things get all sorts of messed up. Every PR from that point on has some wonky commits and I look like a noob. Sometimes the best course of action is to just reset to the a remote branch's master (i.e. the repository I forked the project from) and get on with life that way. Here's how to do so:
git fetch some-remote # "origin" if you want to use your own branch
git reset --hard some-remote/master
The first step is fetching a list of branches from the remote. The next is executing a hard reset of the branch based on the remote.
Now you can stop asking yourself how things got so messed and up can get back to business!
I get asked loads of questions every day but I'm always surprised that they're rarely questions about code or even tech -- many of the questions I get are more about non-dev stuff like what my office is like, what software I use, and oftentimes...
David asked me if I'd be up for a guest post picking out some of my favorite Pens from CodePen. A daunting task! There are so many! I managed to pick a few though that have blown me away over the past few months. If you...
A while back David Walsh published a list of
7 MooTools Plugins You Should Use on Every Website
which included 'AutoGrow' a text area expander plugin. 'AutoGrow' is very similar in results to the class I wrote for Education.com, Flext. I decided to release this...
No one likes a spoiler. Whether it be an image from an upcoming film or the result of a football match you DVR'd, sometimes you just don't want to know. As a possible provider of spoiler content, some sites may choose to warn users ahead...