ghq icon indicating copy to clipboard operation
ghq copied to clipboard

Implement Clone-as-Submodule feature

Open yasuo-ozu opened this issue 2 years ago • 3 comments

Background

There are some needs to manage your ghq root as git repository, for syncing your local stubs, etc.

Changes

This PR changes the default behavior of ghq get like:

  • Check if the target directory is inside git worktree of another git repository.
  • If so, use git submodule add instead.

yasuo-ozu avatar Oct 07 '22 11:10 yasuo-ozu

Thanks for the pull request. It's an exciting idea to git manage the whole ghq root, but I don't hear much else about the need for it, and honestly, I'm not so positive about including this feature. I'll stay open to it for a while, but if no one appears who agrees with this feature, I'll close it later.

Songmu avatar Oct 07 '22 12:10 Songmu

Thanks for reply. I am considering following situations.

  • Using multiple devices (for example, note pc and desktop pc)
  • I want to manage local repos, which I am working now.
  • ~/ghq directory is a git repo (origin is set to my github.com private repo) (local repos managed in ~/ghq/ may be anything, like my public repo, my private repo or other's public repo (just looking at).)
  • I can sync the working state between devices, using push/pull mechanism and working branch.
  • Here, 'working state' is repos which I am working on, and working branches which I'm creating temporary commits in.
  • Using 3rd-party automatic file sync (like Dropbox) may break local repos.
  • Using tools like rsync is troublesome, and lack of collision fixing.

yasuo-ozu avatar Oct 07 '22 15:10 yasuo-ozu

I think working directly on ~/ghq/ is enough considerable, but someone may have different opinions. If there is any other way (or reason why this example is unsound), please let me know.

yasuo-ozu avatar Oct 07 '22 15:10 yasuo-ozu