Studyon Minte9.com
Git




Website repo users



1) Live (bare repo & website)


	$ mkdir www
	$ mkdir www.git
	$ cd www.git/
	$ git init --bare
	$ cd hooks/
	$ mv post-update.sample post-update
	$ vi post-update
	$ less post-update
	#!/bin/sh
	GIT_WORK_TREE=/d/developments/testgit/www git checkout -f

	$ cd ..
	$ ls
	www  www.git

2) Users 1 repo

	$ git clone /d/developments/testgit/www.git/ user1.www
	$ cd user1.www/
	$ echo "user1 - line1" > index.htm
	$ git add .
	$ git commit -a -m "commit user1"

	$ git remote -v
	origin  d:/developments/testgit/www.git/ (fetch)
	origin  d:/developments/testgit/www.git/ (push)
	$ git push origin master
		// index.htm will appear in www/

	/user1.www (master)
	$ cd ../www
	$ ls
	index.htm

	$ cd ..
	$ ls
	user1.www  www  www.git


3) User 2 repo

	$ git clone /d/developments/testgit/www.git/ user2.www
	$ cd user2.www/
	$ git pull origin master
		// // index.htm will appear in user2.www/

	$ ls
	index.htm
	$ less index.htm
	user1 - line1
	$ vi index.htm
	$ less index.htm
	user1 - line1
	user2 - line2

	$ git commit -a -m "user2 commit"
	$ git push origin master
		// index.htm will appear modified in www/

	$ cd ../www
	$ less index.htm
	user1 - line1
	user2 - line2


4) Check dif
	
	$ cd ../user1.www/
	$ less index.htm
	user1 - line1

	$ git fetch origin
	$ git diff master origin/master
	diff --git a/index.htm b/index.htm
	index 2e54ad1..84dc289 100644
	--- a/index.htm
	+++ b/index.htm
	@@ -1 +1,2 @@
	 user1 - line1
	+user2 - line2

	$ git config push.default current
	$ git pull origin
	Updating 89486bd..9845cb7
	Fast-forward
	 index.htm | 1 +
	 1 file changed, 1 insertion(+)

	$ less index.htm
	user1 - line1
	user2 - line2