Skip to content

Commit dd6b723

Browse files
Fix: undo initial commit- update comments
1 parent ae01059 commit dd6b723

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

ugit

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,8 @@ undo_git_commit() {
5656
initial_commit=$(git rev-list --max-parents=0 --abbrev-commit HEAD)
5757

5858
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
5961
if [[ "$last_commit" == "$initial_commit" ]]; then
6062
if git update-ref -d HEAD && git rm --cached -rf . > /dev/null 2>&1; then
6163
printf "%s\nInitial commit: $initial_commit successfully undone. Commit state is clean."

0 commit comments

Comments
 (0)