Command git-offshoot allows the user to create a git branch, in a similar fashion to built-in git checkout -b.
It also creates an initial commit on that branch and stores the name of the "parent" branch in a file called PARENT.
git offshoot <branch-name>The code for this git command is as follows:
#!/bin/bash
CURRENT_BRANCH=`git rev-parse --abbrev-ref HEAD`
git checkout -b $1
echo $CURRENT_BRANCH > PARENT
git add PARENT
git commit PARENT -m "Initial commit on branch $1"To make the git command available, a git-offshot has to be created in your PATH and it should be executable.
- No check on the presence of
$1in the shell script - Creates a
PARENTfile in the repo