Studyon Minte9.com
Git




Website workflow



"Git init" creates a repository with a working directory so you can actually work (git clone). 
After creating it you will see that the directory contains a .git folder.

"Git init --bare" creates a repository without a working directory (git clone --bare). 
You don't get a directory where you can work. (you'll use hooks)


	/d/developments/testgit

	$ mkdir dev
	$ mkdir www
		
		// DEV repository
	$ cd dev
	$ git init
	$ touch index.htm
	$ git add .
	$ git commit -m "initial commit"
		
		// REMOTE (repository & live directory)
                // For security reasons it's recommended that repository should be outside root directory
	$ cd ../www
	$ mkdir htdocs.git
	$ mkdir htdocs
	
		// INIT BARE repository (without working directory)
	$ cd htdocs.git/
	$ git init --bare
	$ cd hooks/
	$ mv post-update.sample post-update
	$ vi post-update
		// add line:
		// GIT_WORK_TREE=/d/developments/testgit/www/htdocs git checkout -f

	$ cd ../../../dev/

		// ORIGIN
	$ git remote add origin /d/developments/testgit/www/htdocs.git/
	$ git push origin master
		// index.htm from dev/ will be committed to in www/htdocs !

	$ touch index2.htm
	$ git add .
	$ git commit -m "second commit"
	$ git push origin master
		// index2.htm is now also in www/htdocs


* Network driver Z:/ (windows network driver)

	$ git remote add origin /z/application/brdprimarymarkets.git/
	(be aware of last /)

	$ vi post-update
	#exec git update-server-info
	GIT_WORK_TREE=/z/application/brdprimarymarkets git checkout -f


http://www.danielmiessler.com/study/git/#website
http://stackoverflow.com/questions/7861184/what-is-the-difference-between-git-init-and-git-init-bare