Open MathiasSM opened 6 years ago
The way you work with a bare repo in the CLI is a good clue why it's rarely supported. Both the git repo and the working tree must be specified like git --git-dir=$DOTFILES_REPO --work-tree=$HOME
. Neither the repo depends on the tree's location nor the tree on the repo's. I imagine a good developer experience would be to offer a choice when opening a folder without a repo: 1) init with template #342 or 2) configure bare repo location. If it's configured as a bare repo the flags can be passed.
If you just want to be able to browse the history for the bare repository, you can create a clone without creating a checkout:
git clone --no-checkout /path/to/repo.git repo
You'll still need to fetch to see changes to the bare repository though.
A first test with forkgit seems somewhat succesful:
bin/git
as a custom git instancegit clone --bare <some-git-repository>
.forkgit
file with these contents:
git-dir = .
.git
directory in the bare repository directoryThis allows browsing the commit log. Local Changes just shows no files.
Updating the bare repository from a remote requires extra steps. See How do I update my bare repo? on StackOverflow. After fetching Fork doesn't register that the local branch has moved.
Note that forkgit has only been tested on macOS.
I would like to be able to manage bare repositories the same way I manage regular repositories in this app. I use bare repositories to keep track of scattered files, usually configuration files. There are other personal uses (besides git servers, in which all repos are bare repos)
I think the main things to consider here to implement the feature is 1. the ability to ignore untracked files, 2. adding a repo not by working dir but by .git (which in this case can by .anything), and 3. just check current changes to any file listed in the git db? Dunno, I know very little about git internals. Would love to take a look at how this works, though, to understand why only so few git GUIs implement it.