workset is yet another tool for managing git repos locally.
Simply defined, a working set is all of the repositories you need to work on at any given time. Even more simply, your workspace is the local directory where you keep your Git repositories.
For many developers, our Git workspaces tend to become "libraries" that contains all the projects we've ever worked on, spanning multiple Git providers. A quick survey revealed that I had 46 personal repos in my workspace and 192 for my job. With all of that junk piled up, it becomes hard to remember what repos have outstanding changes that still need to be completed.
The principle behind workset is that your workspace should only consist of your working set. This reduces unnecessary noise as repositories accumulate in your workspace over time and improves indexing performance of your development tools.
Adhering to this principle involves frequently cloning and deleting repositories
from your workspace, so workset makes these mechanics fast and easy. When
repositories are dropped from your workspace, they are just saved locally in a
library so restoring them later can be done in an instant.
Maybe not actually, but they can delete your account along with your repos any day of the week. It has happened before. Don't let them have full control of your repos! workset keeps full mirrors of all of your repos locally to keep them safe.
All workset commands run in reference to the current directory.
# Initialize a new workspace in the current directory
❯ workset init
# Add a repository to your working set
❯ workset github.com/jqlang/jq
# The repository's local path always reflects the remote path
❯ cd ./github.com/jqlang/jq
# Drop the repo from the working set (it remains in the library)
❯ cd ..
❯ workset drop ./jq
# Or, you can drop all repositories in the current directory (any that have
# unpushed changes will not be touched).
❯ workset drop
# If you don't want a repo to remain in the library, use --delete
❯ workset drop --delete ./delete_this_repo
# When you need to work on a repository again, it's restored from the local library.
# Any upstream changes are also fetched.
❯ workset jqThe shell autocomplete is smart enough to look at your CWD and suggest repos that you might want to restore into your working set. Repos that were dropped most recently are sorted first.
# Library contains: jqlang/jq
❯ workset jql[TAB]
jqlang/jqRun workset without arguments to launch an interactive TUI from the current
directory:
# Launch interactive repository browser
❯ workset
# Use j/k or arrow keys to navigate
# Press / to fuzzy find repositories
# Press Enter to add the selected repository to your working set
# Press q to quit