Undo File Changes with Git
One of my favorite features in modern text editors is their ability to integrate tools to format code upon every save. When you're working on legacy projects, however, auto-formatting can be a problem; if you open a file that you don't explicitly change, the file may still get modified by the formatter. This all leads to
git status showing a bunch of file modifications that you don't want.
To quickly undo file changes with git, execute the following two commands:
git reset HEAD path/to/file.ext
git checkout path/to/file.ext
The second command (
checkout) is required or you'll still see the file listed when running
git status again. With both of those executions, you'll no longer see the file listed with
git makes version control easy but the two steps needed to essentially revert changes to a file aren't intuitive, thus I thought I would share on this blog. Happy coding!
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...
This is the hardest thing I've ever had to write, much less admit to myself. I've written resignation letters from jobs I've loved, I've ended relationships, I've failed at a host of tasks, and let myself down in my life. All of those feelings were very...
I released a MooTools comment preview script yesterday and got numerous requests for a jQuery version. Ask and you shall receive! I'll use the exact same CSS and HTML as yesterday.
On the keypress and blur events, we validate and...