Studyon Minte9.com
Git




Git clone & push



	// --- site1 (master)

	$ mkdir site1
	$ cd site1/
	$ git init
	$ echo "1" > index.htm
	$ git add .
	$ git commit -m "first"

	$ cd ..

	$ git clone /d/developments/testgit/site1/ site1.local
	Cloning into 'site1.local'...
	done.
	
	// --- site1.local (master)

	$ cd site1.local/
	$ echo "2" > index.htm
	$ git commit -a -m "m"
	$ git remote -v
	origin  d:/developments/testgit/site1/ (fetch)
	origin  d:/developments/testgit/site1/ (push)
	
	$ git push origin master
		...
		remote: error: refusing to update checked out branch: refs/heads/master
	

	// --- site1 (master)

	$ cd ../site1
	$ git branch -m master live
		// move/rename branch


	// site1.local (master)
	$ git push origin master
	Counting objects: 5, done.

	// site1.local (master)
	$ less index.htm
	2

	// site1.local (master)
	$ less ../site1/index.htm
	1
		// not good !!! it should be 2

	// site1.local (master)
	$ cd ../site1

	// site1 (live)
	$ git checkout master
	Switched to branch 'master'

	// site1 (master)
	$ less index.htm
	2


http://stackoverflow.com/questions/8985782/git-push-fails-refusing-to-update-checked-out-branch-refs-heads-master