Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
46 lines (35 sloc) 3.7 KB

Do NOT align variables declaration

This project is an attempt to demonstrate why variable declaration alignments is, in general, a bad thing while coding:


$bar     = "baz";
$foo     = "bar";
$myFoo   = "myBar";
$myStuff = "foo";

When code like this is modified over the time, lines needs some rearrangments.

Hopefully, this is a bit easier using the git command line client:

$ git blame example.php
$ git show ff5d20b5
$ git blame example.php ff5d20b5~
$ git show 3ae2a3b9
$ git blame example.php 3ae2a3b9~
$ git show 071932d  

But still! Far way too much operations IMHO for a usual task.

  • Last but not least, by increasing the number of lines changed in every commits, chance is high to increase the number of possible conflicts. For the same reason it will also make backporting (cherry-picking) of fixes on those lines in your version branches much more difficult since likely to conflict.

If you are already convinced by the necessity of using atomic commits in revision control tools, time has come to also forget that kind of alignment aesthetics as it would prevent you from achieving all the goals of atomic commits. See more info on:\_commit#Atomic\_Commit\_Convention