From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: X-Spam-Status: No, score=-3.6 required=3.0 tests=AWL,BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS shortcircuit=no autolearn=ham autolearn_force=no version=3.4.6 Received: from out1.vger.email (out1.vger.email [IPv6:2620:137:e000::1:20]) by dcvr.yhbt.net (Postfix) with ESMTP id DB88F1F452 for ; Mon, 3 Apr 2023 18:45:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232994AbjDCSp3 (ORCPT ); Mon, 3 Apr 2023 14:45:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52460 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231627AbjDCSp1 (ORCPT ); Mon, 3 Apr 2023 14:45:27 -0400 X-Greylist: delayed 509 seconds by postgrey-1.37 at lindbergh.monkeyblade.net; Mon, 03 Apr 2023 11:45:26 PDT Received: from vps.thesusis.net (vps.thesusis.net [34.202.238.73]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E8F1A188 for ; Mon, 3 Apr 2023 11:45:26 -0700 (PDT) Received: by vps.thesusis.net (Postfix, from userid 1000) id 333BC112ABA; Mon, 3 Apr 2023 14:36:26 -0400 (EDT) References: User-agent: mu4e 1.7.12; emacs 27.1 From: Phillip Susi To: Hongyi Zhao Cc: Git List Subject: Re: git revert with partial commit. Date: Mon, 03 Apr 2023 14:29:55 -0400 In-reply-to: Message-ID: <87edp0ak45.fsf@vps.thesusis.net> MIME-Version: 1.0 Content-Type: text/plain Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Hongyi Zhao writes: > Hi here, > > I want to revert a previous commit partially, as follows: > > werner@X10DAi:~$ git log |grep -A3 -B5 -m1 texstudio > commit f18fbd1e16a1ca4215621768d17858c036086608 > Author: Hongyi Zhao > Date: Sun Aug 1 20:01:02 2021 +0800 > > deleted: Public/CTAN/IDE/phonon/compile-install-phonon > deleted: Public/CTAN/IDE/texstudio-org/texstudio.git.sh > modified: Public/repo/github.com/Dushistov/sdcv.git.sh > deleted: Public/repo/github.com/goldendict/stardict-relative/bigdict > > More specifically, I just want to revert the following ones: > > deleted: Public/CTAN/IDE/phonon/compile-install-phonon > deleted: Public/CTAN/IDE/texstudio-org/texstudio.git.sh > > Is this possible? If you are comfortable with git-gui and gitk, then I would say just revert it, then click ammend the previous commit in git-gui, and click to unstage the changes you DON'T want to revert, then commit. If you want to do it from the command line, then git-revert, then git checkout HEAD~1 -- ( the other 4 file names here ) will get back the other 4 files then you can git commit --amend. Alternatively you can skip git-revert and instead git checkout f18fbd1e16~1 -- (the two files that you DO want to revert), then git commit.