Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get a detached repository working

Tags:

git

repository

I am just starting with git. Using command line. I created a working direcotry and then a repository inside it. I have several transactions of add, commit etc for testing. I then moved the repository to another folder. The repository is intact as this works.

cd g:\GITREPO
git status

If I now go to the working directory, the git-dir command is not accepted. What am I doing wrong ?

cd g:\GITTEST
git --git-dir=G:\GITREPO

I get no errors, just a dump of the help. If I leave out the path then I get " No Directory Given ". So I have the right command.

like image 802
Rohit Gupta Avatar asked Nov 10 '22 16:11

Rohit Gupta


1 Answers

"git --git-dir=G:\GITREPO" in itself is not a full git command:

  • it calls git,
  • it instructs git the Git database is in G:\GITREPO (which it is not, by the way. It should more probably be in G:\GITREPO\.git),
  • and... it does not tell git what do do (status? fetch? checkout? something?).
like image 93
VonC Avatar answered Nov 15 '22 04:11

VonC