This is pretty much what I do. Every new project gets a new worktree in the wt subdir of the repo named after the branch I am working on. All I need to do to switch projects is cd - no worry about what files will be stashed, what I lose in a branch switch, etc. In fact I have wrapped all of this in scripts that keep track of all these directories so that I type git go to get a list of them in a SELECT menu and git go <regexp. to filter the choices,
Nope. I have a LARGE set of git wrappers such that when I type:
github-forknclone someorg/somerepo
the repo gets forked if I haven't already
the repo gets cloned in ~/gits/github/org/repo
the command creates the directory ~/gits/github/org/repo/wt.
Then I git go somerepo to cd to ~/gits/github/org/repo and type
git worktree cre foobr
which
creates the foobr branch
cd's to ./wt
creates the foobr directory
creates the foobr worktree, using foobr branch in the foobr directory
It's a hairy complicated mess that has grown over the past 7 years. The key to it all is that I have a function called git. Yep. I do my OWN dispatch. Otherwise, you can't add to existing git commands.
Yeah. I keep thinking about breaking it out into its own repo,but it’s just too intertwined with lots of my utility stuff. And, it could probably use a rewrite in Python or Perl for most of the gymnastics it does in shell with git hub api. But who has the time? I cobbled it together over 7 years at my $job.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
This is pretty much what I do. Every new project gets a new worktree in the wt subdir of the repo named after the branch I am working on. All I need to do to switch projects is cd - no worry about what files will be stashed, what I lose in a branch switch, etc. In fact I have wrapped all of this in scripts that keep track of all these directories so that I type
git go
to get a list of them in a SELECT menu andgit go <regexp.
to filter the choices,The script is a very good idea and it gives me inspiration. Do you use bare repos?
Nope. I have a LARGE set of git wrappers such that when I type:
~/gits/github/org/repo
~/gits/github/org/repo/wt
.Then I
git go somerepo
to cd to~/gits/github/org/repo
and typewhich
foobr
branch./wt
foobr
directoryfoobr
worktree, usingfoobr
branch in thefoobr
directoryIt's a hairy complicated mess that has grown over the past 7 years. The key to it all is that I have a function called
git
. Yep. I do my OWN dispatch. Otherwise, you can't add to existing git commands.If you want to see it: github.com/matthewpersico/personal
That's a kinda neat solution and if that works for you that's good.
Yeah. I keep thinking about breaking it out into its own repo,but it’s just too intertwined with lots of my utility stuff. And, it could probably use a rewrite in Python or Perl for most of the gymnastics it does in shell with git hub api. But who has the time? I cobbled it together over 7 years at my $job.