mirror of
https://github.com/Bhupesh-V/ugit.git
synced 2026-09-10 07:26:20 -04:00
✨ recover deleted tags
This commit is contained in:
parent
170c2fc5ca
commit
09ee6a46ea
17
ugit
17
ugit
|
|
@ -82,8 +82,8 @@ undo_git_reset() {
|
|||
git reset "$last_good_state"
|
||||
}
|
||||
|
||||
# WIP (untested)
|
||||
undo_git_merge() {
|
||||
# WIP (untested)
|
||||
if [[ "$1" == "conflicts" ]]; then
|
||||
git merge --abort
|
||||
elif [[ "$1" == "unpushed" ]]; then
|
||||
|
|
@ -118,6 +118,21 @@ undo_git_stash_apply() {
|
|||
git stash show -p | git apply --reverse
|
||||
}
|
||||
|
||||
# WIP
|
||||
recover_deleted_tag() {
|
||||
# only works for annotead tags? :(
|
||||
|
||||
# git fsck --unreachable | grep tag
|
||||
# to see changes git show <COMMIT_HASH>
|
||||
# git update-ref refs/tags/<tag-name> <COMMIT_HASH>
|
||||
COMMIT_HASH=$(git fsck --no-progress --unreachable | grep tag | cut -d ' ' -f3)
|
||||
read -p "Enter Lost tag name: " -r TAG_NAME
|
||||
if git update-ref refs/tags "$TAG_NAME" --create-reflog "$COMMIT_HASH"; then
|
||||
echo "Tag $TAG_NAME Successfully Recovered"
|
||||
git tag -l | grep "$TAG_NAME"
|
||||
fi
|
||||
}
|
||||
|
||||
case $option in
|
||||
1) undo_git_commit;;
|
||||
2) undo_git_push;;
|
||||
|
|
|
|||
Loading…
Reference in a new issue