git-extras icon indicating copy to clipboard operation
git-extras copied to clipboard

Discussion: Add 'fav' alias to support cloning by repo name

Open bodenr opened this issue 9 years ago • 4 comments

I'm currently maintaining a simple git alias I'm calling fav [1] that supports cloning repos by name based on search URL specified via env var (see the comments in [1] for more details).

Any interest in me porting that here??

[1] https://github.com/bodenr/openstack-git/blob/master/aliases/fav

bodenr avatar Aug 23 '16 21:08 bodenr

I have the same thoughts about this as with #573, although I think this one is slightly harder to justify including. But if someone comes up with a good use case, I will consider it. It's a nifty alias, though.

nicolaiskogheim avatar Sep 11 '16 14:09 nicolaiskogheim

My use case is for OpenStack development. We have many project repos across a handful of github accounts, so using the fav alias is a timesaver when I want to clone an OpenStack repo.

Here's the favs I use (includes my github acct obviously):

export GIT_FAVS=https://github.com/openstack/,https://github.com/openstack-dev/,https://github.com/openstack-infra/,https://github.com/bodenr/

Then it becomes painless to clone any openstack repo:

git fav openstack-repo-name

I guess we'll see if we get any other input.

bodenr avatar Sep 12 '16 16:09 bodenr

What happens if repo-name exists in multiple repos, and you git fav repo-name? I.e. if there is a fork in one of the favs, and the upstream repo is in one of the others.

nicolaiskogheim avatar Sep 12 '16 19:09 nicolaiskogheim

It's not very smart; it just uses the first one it finds.

bodenr avatar Sep 12 '16 19:09 bodenr