A new working directory for each git branch.
npm install git-bd
|7||downloads in the last month|
|Version||1.0.2 last updated 6 months ago|
|Keywords||git, development, branch, directory|
git bd mimics
git branch in usage but
git bd creates a new working directory for each branch you create. The combination of a branch and working directory is what I refer to as a branchdir. Branchdirs allow you to have multiple branches checked out at once.
PATHand ensure it is executable.
~/.bashrcto add Bash completion for
git bdand to add a Bash function,
bd, to switch between branchdirs.
To setup a repo to use
git bd --init.
mkdir git-bd git clone https://github.com/nnutter/git-bd.git master cd master git bd --init
Remember, almost everything that happens in Git can be undone. Don't panic!
- If you mix
git pull --rebaseyou will probably regret it.
- If you mix
git bdyou will probably regret it.
- If you move your branchdir base repo you will have to repair broken symlinks. Some of which are "supposed" to be broken.
Install from npm
npm install -g git-bd
Run these commands if you installed globally with -g
echo PATH=\$PATH:`npm -g list --parseable git-new-workdir | head -n1` >> ~/.bashrc echo . `npm -g list --parseable git-bd | head -n1`/bd.bashrc >> ~/.bashrc
Run these commands if you installed locally without -g
echo PATH=\$PATH:`npm list --parseable git-bd | head -n1` >> ~/.bashrc echo PATH=\$PATH:`npm list --parseable git-new-workdir | head -n1` >> ~/.bashrc echo . `npm list --parseable git-bd | head -n1`/bd.bashrc >> ~/.bashrc
This assumes you did not override
$GB_MASTER_BRANCH which default to
- Commit all changes in all branches. You can reset them off or interactive rebase later to fix them up.
- Remove the existing branchdirs besides
.gb_masterwhich you should keep.
- Move the
- Change directories to
git checkout master.
git bd --init. When prompted you may want to convert existing branches to branchdirs. This will recreate the branchdirs you just removed but will also setup the tracking
git-bdneeds to be aware of them.
git branch -D gb_master.