mirror of
https://github.com/Bhupesh-V/ugit.git
synced 2026-09-10 07:26:20 -04:00
Fix: undo initial commit- update comments
This commit is contained in:
parent
ae010592da
commit
dd6b72346d
2
ugit
2
ugit
|
|
@ -56,6 +56,8 @@ undo_git_commit() {
|
|||
initial_commit=$(git rev-list --max-parents=0 --abbrev-commit HEAD)
|
||||
|
||||
if [[ "$last_commit" == "$commit" ]]; then
|
||||
# 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).
|
||||
# This will not delete the files from your working directory
|
||||
if [[ "$last_commit" == "$initial_commit" ]]; then
|
||||
if git update-ref -d HEAD && git rm --cached -rf . > /dev/null 2>&1; then
|
||||
printf "%s\nInitial commit: $initial_commit successfully undone. Commit state is clean."
|
||||
|
|
|
|||
Loading…
Reference in a new issue