fork-dev / Tracker

Bug and issue tracker for Fork for Mac
505 stars 12 forks source link

Feature Request: Bare repositories management #247

Open MathiasSM opened 6 years ago

MathiasSM commented 6 years ago

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.

texastoland commented 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.

brechtm commented 3 years ago

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.

brechtm commented 1 year ago

A first test with forkgit seems somewhat succesful:

  1. clone the forkgit repository and configure Fork to use its bin/git as a custom git instance
  2. git clone --bare <some-git-repository>
  3. inside the bare repository directory create a .forkgit file with these contents: git-dir = .
  4. create an empty .git directory in the bare repository directory
  5. open the cloned repository in Fork

This 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.