Initial local git repo

Same like svn you can initial a local repo and clone from a local (or network) path instead of an online path like…/project.git to keep your repo locally and share only within your private network.

  1. Under the folder want to create a local repo ie. C:/repos/
    git init --bare yourproject.git
  2. Change folder to your working folder ie. C:/projects/
    git clone /c/repos/yourproject.git
  3. Done. You can start work on it.

After initial a repo you can find the folder structure contains branches, hooks, info, objects, and refs. You can always backup this folder and that is all you need to keep commit log and revisions history.

You can install the git windows client in command prompt or use any other windows client for git.

see also


PHP insert new value at first index in array

There is no straight forward function to obtain this even though it is very easy to accomplish in .NET with .InsertAt(0). Normally what we need to do in PHP we have to clone a new array by declare a new first value, then continue loop the old array, quite stupid a lot of time I found.

However I just found out an elegant way to do that today.

$ori_categories = $this->Course->Category->find('list', array('order' => 'Category.category'));
$all = array(0 => 'All Categories');
$new_categories = $all + $ori_categories;


I heard this also true in Javascript 🙂