/expman

Primary LanguageShellApache License 2.0Apache-2.0

ExpMan

๐Ÿฝ๏ธ ExpMan is a handy experiment management tool based on git-worktree.

Key features

  • ๐Ÿ”ฑ Work on multiple git branches in parallel
  • ๐Ÿ› ๏ธ A set of commands to easily create, fork, checkout and push branches
  • ๐Ÿš€ Integration with fzf, find target in 1 second and jump among 1000+ branches

Why ExpMan?

In machine learning and other experimental sciences, engineers often need to run multiple experiments simultaneously in order to efficiently search for parameters and validate hypotheses. Using Git branches to manage experiments can be very helpful for code comparison and quickly jumping between experiments. However, simple usage of the git-branch and git-checkout commands can only allow working on a single branch at a time. Git-worktree is a great solution for working on multiple branches simultaneously, but with the number of experiments ๐Ÿ“ˆ potentially reaching into the hundreds or thousands in a short period of time, ๐Ÿคฏ engineers can easily lose themselves.

ExpMan provides a set of handy commands that not only allows beginners to quickly master parallel operations on multiple branches, but also integrates the incredibly useful fzf for fuzzy searching ๐Ÿ”Ž among thousands of branches, enabling engineers to quickly find their desired experiments and significantly improving their efficiency in scientific research.

Installation

Currently Only Zsh is supported

  1. Install fzf
  2. Download ExpMan
    git clone https://github.com/megvii-research/expman $HOME/.expman
  3. Load ExpMan by adding one line in ~/.zshrc
    echo '[[ -o interactive ]] && source $HOME/.expman/expman.zsh' >> ~/.zshrc

Get Started

๐Ÿ—๏ธ Create a new repository

# create project
em init <project-name>
# go to project
cd <project-name>

๐Ÿงช Create an empty experiment

# create an experiment, but stay at where you were
em new empty <my-experiment-name> 
# create an experiment, and go to the new experiment dir
em new -c empty <my-experiment-name>

๐Ÿš˜ Goto some experiment

em cd <experiment-name>

๐Ÿ–– Fork existing branch to new

# create an experiment, but stay at where you were
em new <old-experiment> <new-experiment> 
# create an experiment, and go to the new experiment dir
em new -c <old-experiment> <new-experiment>

๐Ÿ“ฅ Checkout a branch

If you clone a repository at a new location, or you have co-workers pushed their experiments to remote

git fetch  # sync with remote
em checkout remotes/origin/<experiment-name>

๐Ÿ“ค Push to remote

em push <experiment-name>

๐Ÿ—‘๏ธ Delete a local branch

em delete <experiment-name>

Note: Only local branch is deleted, to delete a remote branch, use native git command, or simply use your git-web UI like GitHub.

git push <remote> :<branch-name>

๐Ÿ‘€ Integrate with fzf

Press <TAB> following em commands, and magic happens.

em new # press <TAB> 
em cd # press <TAB>
em checkout # press <TAB>

LICENSE

Apache License 2.0