> From: Johannes Müller <dersinndesleb...@gmx.net> > > I tried thinking of a way to prevent accidental deletion by git reset > --hard command, as I recently faced such a problem. How can you write a > wrapper replacing the command, so that it first does something like the > following? It should create a new branch backup with all changes before > resetting. > > current_branch = git command > git checkout -b backup_`date` > git add -A && git commit -m "backup before git reset --hard" > git checkout $current_branch > actual git reset --hard command
That seems to be the normal way things like this are done in Git. But usually, the backup branch seems to be put in refs/original/<full_ref_name_of_branch>, e.g., refs/original/refs/heads/master. Dale -- You received this message because you are subscribed to the Google Groups "Git for human beings" group. To unsubscribe from this group and stop receiving emails from it, send an email to git-users+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.