question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

pre-commit for bare repos with separate working tree and git dir

See original GitHub issue

Hi!

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:closed
  • Created 3 years ago
  • Comments:9 (5 by maintainers)

github_iconTop GitHub Comments

2reactions
asottilecommented, Oct 23, 2020

you can probably also convince git of the weird setup by using GIT_DIR=... GIT_WORK_TREE=... though I didn’t try that approach

0reactions
asottilecommented, Sep 28, 2022

yeah 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

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found