pre-commit for bare repos with separate working tree and git dir
See original GitHub issueHi!
I’m using a setup similar to the one described in this blog to manage my dotfiles. I manage this repo using an aliased version of git which specifies the working tree and the git directory. How would I go about setting up pre-commit to work with setup? (I tried looking through the issues but couldn’t find a similar one)
# Setup Bare repo
$ git init --bare $HOME/.dotfiles.git
# .zshrc
alias dotfiles="/usr/local/bin/git --git-dir=$HOME/.dotfiles.git/ --work-tree=$HOME"
Issue Analytics
- State:
- Created 3 years ago
- Comments:9 (5 by maintainers)
Top Results From Across the Web
How to use git worktree and in a clean way
A bare repository is a repository without a working tree. It only contains what you would normally find under the .git directory.
Read more >hooks
This hook can be used in conjunction with a corresponding pre-commit hook to save and restore any form of metadata associated with the...
Read more >In a git hook is the current working directory guaranteed to ...
Before Git invokes a hook, it changes its working directory to either the root of the working tree in a non-bare repository, or...
Read more >Git Worktrees: The Best Git Feature You've Never Heard Of
This stores only the repo metadata and has no actual working tree. I keep this in a separate hidden directory so that I...
Read more >githooks - Hooks used by Git
Before Git invokes a hook, it changes its working directory to either $GIT_DIR in a bare repository or the root of the working...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
you can probably also convince git of the weird setup by using
GIT_DIR=... GIT_WORK_TREE=...
though I didn’t try that approachyeah just because lots of people do a weird / bad idea doesn’t make it a good idea
using a non existent work tree from a bare repo is asking for trouble