We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent ae01059 commit dd6b723Copy full SHA for dd6b723
ugit
@@ -56,6 +56,8 @@ undo_git_commit() {
56
initial_commit=$(git rev-list --max-parents=0 --abbrev-commit HEAD)
57
58
if [[ "$last_commit" == "$commit" ]]; then
59
+ # If the last commit is the same as the initial commit, delete reference to the branch(update-ref) and unstage changes of the initial commit(git rm).
60
+ # This will not delete the files from your working directory
61
if [[ "$last_commit" == "$initial_commit" ]]; then
62
if git update-ref -d HEAD && git rm --cached -rf . > /dev/null 2>&1; then
63
printf "%s\nInitial commit: $initial_commit successfully undone. Commit state is clean."
0 commit comments