Symfony 2 docs and tutorials

symfony2

The last few week I’ve been working quite a lot with Symfony 2, it’s not the simplest of frameworks and for my next project I think I’ll try another framework – But thats another story. Here are some links and tips to help bail you out, when you inevitably get stuck.

Links

  1. Symblog – This in my opinion is the best place to start learning Symfony 2. Dsyph3r – The author, has created a bunch of tutorials, to walk you through the process of creating a blog. Sadly the tutorials arn’t complete but the amount you can learn quick, makes this the ideal place to get going.
  2. Symfony 2 Cheat Sheet – This is the biggest cheat sheet I’ve ever seen, but Symfony 2 is pretty huge. Here you will find tonnes of snipets to help you with your controllers, routing, Twig templating, Doctrine 2, unit and functional testing, forms & validation, security, caching, translations and the service container.
  3. Symfony 2 Official Website – The amount of docs on this website are extreme, however I find it to boring to read through. However for some areas of Symfony 2, this is the only place you’tre going to get docs which actually make sense.
  4. Symfony 2 API – Exactly what it says on the tin. This is useful, however I find it easier just looking through the Symfony 2 classes myself.

Continue reading →

Reset your Git repository back to a previous commit

Reset your Git repository back to a previous push

Earlier today I accidentally deleted quite a lot of code from a Git repo, quickly realising I had made a catastrophic error, I scoured Stack Overflow for a way to reset by entire repository back to a previous commit. Here’s what I found:

First things first make sure your current checkout has no local changes, if it does stash them or just create another clone of the branch you are using.

git stash -u save “My Wicked Cool Feature to stash”

or

git clone repo_url

Reset your working copy, so that it matches exactly what was in your branch during the commit you are reseting to.

git reset --hard sha1_hash

Although you won’t be able to see any changes when you run “git status”, running the below command, will publish the old revision back to HEAD.

git push -f

That’s all, your online repository will now be reset back to the previous commit.