Skip to content

Instantly share code, notes, and snippets.

@mike623
Created June 2, 2020 11:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mike623/24f44dbc390762c13e27e1ce60db7698 to your computer and use it in GitHub Desktop.
Save mike623/24f44dbc390762c13e27e1ce60db7698 to your computer and use it in GitHub Desktop.
fork on current commit and reset move back old branch
#!/bin/bash
branch_name=$(git rev-parse --symbolic-full-name --abbrev-ref HEAD);
echo "create new branch and reset prev of $branch_name";
git checkout -b $1
git checkout $branch_name
# reset pervious version
git reset --hard HEAD~1
git checkout $1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment