# how do I exclude a commit from set of commits to be pushed.

5 messages from 2010-07-03 to 2010-07-06. Participants: Mahesh Vaidya, Johan Herland, Eric Raible.
Thread: https://gitlist.dev/t/24276

## Mahesh Vaidya, 2010-07-03 15:35

Subject: how do I exclude a commit from set of commits to be pushed.
Message-ID: <AANLkTiko8joz_a94QwHwdDwlsjXslu8LdWAnJuvShFFI@mail.gmail.com>
URL: https://gitlist.dev/e/AANLkTiko8joz_a94QwHwdDwlsjXslu8LdWAnJuvShFFI%40mail.gmail.com

```
In the series of commits C1..C8 how do I exclude a commit to be pushed.

use case -
I have commits say C1..C8 to be pushed. Due to my pre-receive hook
commit C4 is complying with commit standard. I have amended C4 to C5 ;
still C4 shows up in commits to be pushed list.

git reflog delete --rewrite and git gc --prune did not help

Thx/ Mahesh
--

```

## Johan Herland, 2010-07-03 16:04

Subject: Re: how do I exclude a commit from set of commits to be pushed.
Message-ID: <201007031804.33350.johan@herland.net>
URL: https://gitlist.dev/e/201007031804.33350.johan%40herland.net
In-Reply-To: <AANLkTiko8joz_a94QwHwdDwlsjXslu8LdWAnJuvShFFI@mail.gmail.com>

```
On Saturday 03 July 2010, Mahesh Vaidya wrote:
> In the series of commits C1..C8 how do I exclude a commit to be pushed.
> 
> use case -
> I have commits say C1..C8 to be pushed. Due to my pre-receive hook
> commit C4 is complying with commit standard. I have amended C4 to C5 ;
> still C4 shows up in commits to be pushed list.
> 
> git reflog delete --rewrite and git gc --prune did not help
> 
> Thx/ Mahesh

You probably want to squash C5 into C4. Look up 'git rebase --interactive', 
and the 'squash' instruction. A good intro can be found at either 
http://book.git-scm.com/4_interactive_rebasing.html or 
http://progit.org/book/ch6-4.html

In general, it seems you have misunderstood the purpose of the reflog. The 
reflog only keeps track of where your HEAD has pointed previously, and what 
operations you have done. Rewriting the reflog does NOT change the actual 
commit, nor does it rewrite your commit history in any way. In other words, 
there is nothing you can do to the reflog that will affect what you push.

You may want to read the entire Pro Git book ( http://progit.org/book/ ) to 
get a firm grip on the Git object model.


...Johan

-- 
Johan Herland, <johan@herland.net>
www.herland.net

```

## Mahesh Vaidya, 2010-07-03 17:37

Subject: Re: how do I exclude a commit from set of commits to be pushed.
Message-ID: <AANLkTimmCdCn1dkbogdVqzPBMeGQDNEesM8zdarFL_wv@mail.gmail.com>
URL: https://gitlist.dev/e/AANLkTimmCdCn1dkbogdVqzPBMeGQDNEesM8zdarFL_wv%40mail.gmail.com
In-Reply-To: <201007031804.33350.johan@herland.net>

```
Hi

Thank for the pointer; Do you think following scriptlet is good for
modifying specific commit ? and do edit.

cat ./modify_specific.sh
git rebase -i $1 && git commit --amend && git rebase --continue

Thank you in advance
-Mahesh

> You probably want to squash C5 into C4. Look up 'git rebase --interactive',
> and the 'squash' instruction. A good intro can be found at either
> http://book.git-scm.com/4_interactive_rebasing.html or
> http://progit.org/book/ch6-4.html
>

>
> You may want to read the entire Pro Git book ( http://progit.org/book/ ) to
> get a firm grip on the Git object model.
>
>
> ...Johan
>
> --
> Johan Herland, <johan@herland.net>
> www.herland.net
>



-- 
Thank you and best regards.
Mahesh Vaidya  / 9740500144
http://www.twitter.com/forvaidya

```

## Johan Herland, 2010-07-03 20:39

Subject: Re: how do I exclude a commit from set of commits to be pushed.
Message-ID: <201007032239.44639.johan@herland.net>
URL: https://gitlist.dev/e/201007032239.44639.johan%40herland.net
In-Reply-To: <AANLkTimmCdCn1dkbogdVqzPBMeGQDNEesM8zdarFL_wv@mail.gmail.com>

```
On Saturday 03 July 2010, Mahesh Vaidya wrote:
> Thank for the pointer; Do you think following scriptlet is good for
> modifying specific commit ? and do edit.
> 
> cat ./modify_specific.sh
> git rebase -i $1 && git commit --amend && git rebase --continue

You would need to do "$1^" instead of $1, since 'rebase' works on all 
commits _since_ the given commit (i.e. not including the given commit). You 
will also have to change the first line of the rebase "script" that is 
opened in your editor (from "pick <sha1> to "edit <sha1>").


...Johan

-- 
Johan Herland, <johan@herland.net>
www.herland.net

```

## Eric Raible, 2010-07-06 19:04

Subject: Re: how do I exclude a commit from set of commits to be pushed.
Message-ID: <loom.20100706T205232-421@post.gmane.org>
URL: https://gitlist.dev/e/loom.20100706T205232-421%40post.gmane.org
In-Reply-To: <201007032239.44639.johan@herland.net>

```
Johan Herland <johan <at> herland.net> writes:

> 
> On Saturday 03 July 2010, Mahesh Vaidya wrote:
> > git rebase -i $1 && git commit --amend && git rebase --continue
> 
> You would need to do "$1^" instead of $1, since 'rebase' works on all 
> commits _since_ the given commit (i.e. not including the given commit)....

The above will suffice if you just want to change the commit message.
If you want to change file contents you'll need a 'git add' as well.

```
