Re: Fake bare git repos

2011-04-18 Thread Richard Hartmann
On Wed, Apr 6, 2011 at 11:10, martin f krafft  wrote:
>  git config core.worktree ../../     # ~/.fgits/vim.git/../../ → ~

FYI, this works:

  git config core.worktree ~/


Richard
___
vcs-home mailing list
vcs-home@lists.madduck.net
http://lists.madduck.net/listinfo/vcs-home

Re: Fake bare git repos

2011-04-06 Thread martin f krafft
also sprach Richard Hartmann  [2011.04.02.2203 
+0200]:
> Can someone dump a current snippet that will create a fake bare
> git repo that works locally _and_ allows me to push to a truly
> bare remote?

The concept of "fake bare git" comes from the fact that the GIT_DIR
is names e.g. vim.git (instead of .git), which is like a bare repo,
but core.bare is set to false (hence "fake"), because there is
a worktree, albeit it's detached.

I think "detached worktree repository" also covers it and might be
a better name.

Here is how to create one:

Create a *non-bare* repo as you would always do, but in a temp
directory (or directly in ~ if you wish):

  mkdir mytempworktree && cd mytempworktree
  git init
  git remote add origin ssh://server/path/to/repo
  git config branch.master.remote origin
  git config branch.master.merge refs/heads/master

Or if the repo already exists remotely, clone it into a temp
directory (or ~):

  mkdir mytempworktree && cd mytempworktree
  git clone git://git.madduck.net/madduck/pub/etc/vim.git

Then move the GIT_DIR to the final location and set core.worktree
to point to the worktree (~ in our case)

  git config core.worktree ../../ # ~/.fgits/vim.git/../../ → ~
  mv .git ~/.fgits/vim.git

and possibly move checked out files to the worktree:

  mv * .* ~

To work with the repo, make sure to export

  GIT_WORK_TREE=$HOME
  GIT_DIR=$HOME/.fgits/repo.git

  or:
alias git="git --work-tree=$HOME --git-dir=$HOME/.fgits/repo.git")

Essentially, this is what my vcsh function does for me:

  http://git.madduck.net/v/etc/zsh.git/blob/HEAD:/vcsh

-- 
martin | http://madduck.net/ | http://two.sentenc.es/
 
"glaube heißt nicht wissen wollen, was wahr ist."
 - friedrich nietzsche
 
spamtraps: madduck.bo...@madduck.net


digital_signature_gpg.asc
Description: Digital signature (see http://martin-krafft.net/gpg/sig-policy/999bbcc4/current)
___
vcs-home mailing list
vcs-home@lists.madduck.net
http://lists.madduck.net/listinfo/vcs-home