Skip to content

Instantly share code, notes, and snippets.

@Mearman
Last active January 9, 2023 16:00
Show Gist options
  • Select an option

  • Save Mearman/02769607e96f0d75ad8ad6ba725e85c6 to your computer and use it in GitHub Desktop.

Select an option

Save Mearman/02769607e96f0d75ad8ad6ba725e85c6 to your computer and use it in GitHub Desktop.
Git WIP
alias git-wip='function _git-wip() {
branchName="WIP/$(date -Idate | cut -c1-4)/$(date -Idate | cut -c6-7)/$(date -Idate | cut -c9-10)"
# git checkout -b "$branchName" || git checkout "$branchName"
# Check if the branch already exists
if git rev-parse --verify "$branchName" >/dev/null 2>&1; then
# Check out the existing branch
git checkout "$branchName"
else
# Create a new branch and check it out
git checkout -b "$branchName"
fi
echo
echo "$(git status --porcelain)"
echo
git commit -am "$(date -u +`%Y-%m-%dT%H:%M:%SZ`)" -m "$(git status --porcelain)"
};_git-wip'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment