From: Noam Yorav-Raphael <noamraph@gmail.com>
To: git@vger.kernel.org
Subject: Fwd: Idea: add --squash to cherry-pick
Date: Thu, 11 Aug 2022 11:53:11 +0300 [thread overview]
Message-ID: <CAO8o=D7QC71mnyKSceMpYJzVO4=POva=mJQ1bi0teUHPB9xesA@mail.gmail.com> (raw)
In-Reply-To: <CAO8o=D6p+aFOeRdTDHwPa1E+V45Uqh-TuSZbz0WU=rE-ksGj_w@mail.gmail.com>
Hi,
Here's something I need regularly, which I haven't found an easy
solution for yet. If there's support, I may try and implement it.
The need is described in this Stack Overflow question:
https://stackoverflow.com/q/35123108. It's fairly popular (107 votes
for the question, 154 for the best answer), but I find the suggested
solution lacking.
Basically, I would like to add a flag --squash to the cherry-pick
command, that would apply the diff between the start and end of the
specified range in one operation.
The use case is that there's a feature branch which I would like to
apply on another branch as one commit.
I could use the `-n` flag to apply all the commits from the source
branch without committing them. However, if there are conflicts, I
would have to deal with them on every commit applied. Instead, what I
want is to just apply the diff between the first and last commit, and
then deal with the conflicts.
I find this to be a very natural operation. Usual cherry-pick applies
the difference between commit A^ and commit A over HEAD. The suggested
`git cherry-pick --squash A..B` would apply the difference between
commit A and commit B over HEAD.
What do you think?
Thanks,
Noam
next parent reply other threads:[~2022-08-11 8:53 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <CAO8o=D6p+aFOeRdTDHwPa1E+V45Uqh-TuSZbz0WU=rE-ksGj_w@mail.gmail.com>
2022-08-11 8:53 ` Noam Yorav-Raphael [this message]
2022-08-11 15:42 ` Fwd: Idea: add --squash to cherry-pick Johannes Sixt
2022-08-11 16:43 ` Junio C Hamano
2022-08-12 8:37 ` Noam Yorav-Raphael
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='CAO8o=D7QC71mnyKSceMpYJzVO4=POva=mJQ1bi0teUHPB9xesA@mail.gmail.com' \
--to=noamraph@gmail.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.
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).