Question

With all the net publicity of how great git is over the existing repositories that we had been used to like SourceSafe or MKS etc. I decided to use it for a project of mine.

It is bad practice to host your repository (aka .git) within the same folders that you work in - you could accidentally overwrite your repo and I thought that I could have hosted it external to my coding directories. On searching for advice on google, I was directed to stackoverflow - where I was advised to symbolically soft link (connect) my external .git repository to my coding directories. So, this is what I did

C:/my_codebase/.git was where i had done and init and created my git repo c:/eclipseWorkSpace/my_codeProject was where I ran these git commands using the bash git shell

My Git Install was Git-1.9.0-preview20140217

STEP 1 Trying to create a shortcut or symbolic link to my real repo hoping that git would be fooled into thinking that it is working with a real .git folder within my code base

$ ln -s 'C:/my_codebase/.git' '.' ln: creating symbolic link ./.git' toC:/tasha_codebase/.git': Permission denied

STEP 2 - i thought it had not been created - noticed in fact it had created a FRESH .git directory instead which was not even symbolically linked/connected to the real repo I was trying - hence the message I recvd below when I thought of executing the command again thinking that the single quotes around my dot for curr directory was wrong.

$ ln -s 'C:/my_codebase/.git' . ln: `./.git': cannot overwrite directory

If I was a buying a car as a consumer from the makers from git - I would have asked for my money back long ago. At least the DSL for a car is intuitive - WhatYouThinkIsWhatYouGet - you want to turn right you turn the steering wheel to the right - you dont spend nights figuring out why it has not turned right.

So, what am I doing wrong ?
Is there a DVCS repo out there which has collaborative processes like GitHub that allows external working directories -- EASILY -- without having to LEARN all this symbolic doodah workarounds ?

After all thinking so much is like work - which is stopping us from coding which is like playing.

Was it helpful?

Solution

What about the work-tree and git-dir parameters and corresponding environment variables?

git --work-tree=XXXX-checkout clone XXXX

will put what would have been in .git in XXXX and the checkout of your working directory will be in XXXX-checkout. If you now set your environment up to point to the two locations, thus

export GIT_WORK_TREE=$PWD/XXX-checkout
export GIT_DIR=$PWD/XXXX

you can then work (fairly) normally with your checkout.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top