git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Pratyush Yadav <me@yadavpratyush.com>
To: Vipul <finn02@disroot.org>
Cc: git@vger.kernel.org
Subject: Re: Support for an interactive confirmation prompt when users can possibly lose their work like some UNIX commands
Date: Wed, 28 Aug 2019 03:52:24 +0530	[thread overview]
Message-ID: <20190827222224.yypf3ydvsebxypb6@yadavpratyush.com> (raw)
In-Reply-To: <c1136131-0a9e-9dbb-3ad7-495ac96c1ef0@disroot.org>

On 27/08/19 09:53AM, Vipul wrote:
> Hi,
> 
> Sometimes, I messed-up with git repository and lost works due
> carelessness. This includes reset a branch instead of other, drop the
> stash etc by mistake. I wonder, is there way to a get an interactive
> confirmation prompt (which ask for yes/no option) before executing those
> commands when users can possibly lose their work? Like, some UNIX
> commands have support for an interactive prompt (like 'rm -i', 'mv -i',
> 'cp -i', etc) for ex: before deleting and overwriting a file a
> confirmation is prompt and asking for users permission.
> 	If there would no such feature available in git, so how do other people
> avoid these kind of mistakes? Obviously, one them would be recheck the
> command carefully before executing it and repo status but, I think
> sometimes people also do these kind of mistakes. For now, to minimize
> some of these kind problems I've modified my bash shell prompt to show
> all kind information related to a git repository by sourcing
> "git-prompt" script (provided with git package) and turn on all of flags
> provided by it which significantly increase my productivity and less
> mistakes than earlier. But, anything else I can do to avoid these kind
> of mistakes at first place or increase my productivity (it includes
> adopting some best practices, using some command line tools etc).
>   	I searched it on the Internet and found that there are many GUI tools
> available which help with these problems but don't want to use GUI tools
> because most of time I work in command line environment and love using
> command line tool than GUI one.
 
On top of Jeff's great answer, I'll add that I try to not keep my work 
local for too long. I usually push out changes, even when they are WIP, 
to a fork kept on a server somewhere (GitHub for my personal projects). 
This way, if I mess up something real bad, I can clone the repo from the 
server and recover my work, at least partially.

[snip]

-- 
Regards,
Pratyush Yadav

      parent reply	other threads:[~2019-08-27 22:22 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-27  9:53 Support for an interactive confirmation prompt when users can possibly lose their work like some UNIX commands Vipul
2019-08-27 19:05 ` Jeff King
2019-08-27 22:42   ` Vipul
2019-08-28 15:05     ` Jeff King
2019-08-28 15:27       ` Duy Nguyen
2019-08-27 22:22 ` Pratyush Yadav [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190827222224.yypf3ydvsebxypb6@yadavpratyush.com \
    --to=me@yadavpratyush.com \
    --cc=finn02@disroot.org \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).