All of lore.kernel.org
 help / color / mirror / Atom feed
From: Kevin Bracey <kevin@bracey.fi>
To: Atsushi Nakagawa <atnak@chejz.com>
Cc: git@vger.kernel.org
Subject: Re: Reset by checkout?
Date: Sat, 31 May 2014 10:27:04 +0300	[thread overview]
Message-ID: <53898448.8040105@bracey.fi> (raw)
In-Reply-To: <20140531144610.754B.B013761@chejz.com>

On 31/05/2014 08:46, Atsushi Nakagawa wrote:
>    `git checkout -B <current-branch-name> <tree-ish>`
>
> This is such an useful notion that I can fathom why there isn't a better,
> first-tier, alternative.q
I'm 100% in agreement. "Reset current branch to X" is an extremely 
common operation, and I use this all the time. But having to actually 
name the current branch is silly, and like you, I'm prone to swapping 
the parameters.

I guess in theory using "checkout" allows fancier extra options like 
"--merge" and "--patch", but I don't think I've ever used those with 
checkout, let alone this mode, where I really do just want a "reset", 
with safety checks.

The original "git reset --hard" used to be a pretty top-level command. 
It was used for aborting merges in particular. But I think it now stands 
out as being one of the only really dangerous porcelain commands, and I 
can't think of any real workflow it's still useful for. Maybe it could 
now be modified to warn and require "-f" to overwrite anything in the 
working tree?

While digging into this, it seems "git reset --keep" is actually pretty 
close to "git checkout -B <current branch>". It certainly won't lose 
your workspace file, but unlike checkout it /does /forget what you've 
staged, which could be annoying. Maybe that could be modified to keep 
the index too?

(I like your alias.become - might try that).

Kevin

  parent reply	other threads:[~2014-05-31 12:47 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-05-31  5:46 Reset by checkout? Atsushi Nakagawa
2014-05-31  7:03 ` Andreas Schwab
2014-06-01  2:56   ` Atsushi Nakagawa
2014-05-31  7:27 ` Kevin Bracey [this message]
2014-06-01  4:26   ` Atsushi Nakagawa
2014-06-01  8:45     ` Kevin Bracey
2014-06-02 21:54       ` Junio C Hamano
2014-06-03 19:48         ` Kevin Bracey
2014-06-03 21:48           ` Felipe Contreras
2014-06-07  4:54       ` Atsushi Nakagawa
2014-06-07 14:52         ` Philip Oakley
2014-06-09 20:12           ` Kevin Bracey
2014-06-07  4:55     ` Atsushi Nakagawa
2014-05-31 10:56 ` Felipe Contreras
2014-05-31 23:39   ` Felipe Contreras
2014-06-01  4:58     ` Atsushi Nakagawa
2014-06-02 21:29 ` Junio C Hamano
2014-06-02 21:31   ` Junio C Hamano

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

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

  git send-email \
    --in-reply-to=53898448.8040105@bracey.fi \
    --to=kevin@bracey.fi \
    --cc=atnak@chejz.com \
    --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.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.