git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: Proposal: create meaningful aliases for git reset's hard/soft/mixed

From
Jeff King <peff@peff.net>
Date
Dec 18, 2012, 16:30 UTC
Message-ID
<20121218163057.GB20122@sigill.intra.peff.net>
In-Reply-To
<CANiSa6h3Qf=6hw6fzHVw=CeuhnNeq+cuEvwwmVhUaSOcVgCSBA@mail.gmail.com>
On Mon, Dec 17, 2012 at 10:34:07PM -0800, Martin von Zweigbergk wrote:
Show 10 quoted lines
> On Wed, Nov 23, 2011 at 10:51 AM, Junio C Hamano <gitster@pobox.com> wrote:
> >
> > I am guilty of introducing "git reset --soft HEAD^" before I invented
> > "commit --amend" during v1.3.0 timeframe to solve the issue "soft" reset
> > originally wanted to.
> 
> I do use "commit --amend" a lot, but I still appreciate having "reset
> --soft". For example, to squash the last few commits:
> 
> git reset --soft HEAD^^^ && git commit --amend
Me too. Another one I use is:
  $ hack hack hack
  $ git commit -m wip
  $ git checkout something-else
  ... time passes ...
  $ git checkout orig-branch
  $ git reset --soft HEAD^
  $ hack hack hack
  $ git diff
  $ git add -p
  $ git commit

which ends up with the same history as "commit --amend", but in between the reset and the commit, the bogus WIP commit is thrown away entirely. And things like "diff" and "add -p" do what you want, instead of showing your progress on top of the WIP.

-Peff
Previous: Junio C Hamano
Message 22 of 22 in “Proposal: create meaningful aliases for git reset's hard/soft/mixed”
  1. Philippe VaucherNov 23, 2011
  2. Matthieu MoyNov 23, 2011
  3. Philippe VaucherNov 23, 2011
  4. Martin von ZweigbergkDec 18, 2012
  5. Nguyen Thai Ngoc DuyNov 23, 2011
  6. Junio C HamanoNov 23, 2011
  7. Philippe VaucherNov 23, 2011
  8. Phil HordDec 1, 2011
  9. Thomas RastDec 2, 2011
  10. Miles BaderDec 2, 2011
  11. Phil HordDec 2, 2011
  12. Philippe VaucherDec 2, 2011
  13. Phil HordDec 2, 2011
  14. Philippe VaucherDec 6, 2011
  15. Phil HordOct 3, 2012
  16. Junio C HamanoOct 3, 2012
  17. Junio C HamanoOct 3, 2012
  18. Jan EngelhardtDec 15, 2012
  19. Phil HordDec 1, 2011
  20. Martin von ZweigbergkDec 18, 2012
  21. Junio C HamanoDec 18, 2012
  22. Jeff KingDec 18, 2012

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.