git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* removing a commit from a branch
@ 2011-05-04  8:35 Gergely Buday
  2011-05-04  8:45 ` Jeff King
  2011-05-04  9:17 ` Peter Krefting
  0 siblings, 2 replies; 8+ messages in thread
From: Gergely Buday @ 2011-05-04  8:35 UTC (permalink / raw)
  To: git

Hi there,

I have a problematic commit in a series of commits on a branch. It
contains adding a large binary file, which I would like to avoid to
push to our main repository. How can I remove that from the series of
commits? A command-line solution, please, if possible.

Cheers

- Gergely

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: removing a commit from a branch
  2011-05-04  8:35 removing a commit from a branch Gergely Buday
@ 2011-05-04  8:45 ` Jeff King
  2011-05-04  8:55   ` Gergely Buday
  2011-05-04  9:17 ` Peter Krefting
  1 sibling, 1 reply; 8+ messages in thread
From: Jeff King @ 2011-05-04  8:45 UTC (permalink / raw)
  To: Gergely Buday; +Cc: git

On Wed, May 04, 2011 at 10:35:08AM +0200, Gergely Buday wrote:

> I have a problematic commit in a series of commits on a branch. It
> contains adding a large binary file, which I would like to avoid to
> push to our main repository. How can I remove that from the series of
> commits? A command-line solution, please, if possible.

Removing it will involve rewriting history, which can create headaches
for people who have built on that history (they will need to rebase
their commits on the rewritten history). But if that's OK, then the
command you want is filter-branch. See "git help filter-branch"; in
particular, the EXAMPLES section contains commands to do exactly what
you want.

-Peff

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: removing a commit from a branch
  2011-05-04  8:45 ` Jeff King
@ 2011-05-04  8:55   ` Gergely Buday
  0 siblings, 0 replies; 8+ messages in thread
From: Gergely Buday @ 2011-05-04  8:55 UTC (permalink / raw)
  To: Jeff King; +Cc: git

> Removing it will involve rewriting history, which can create headaches
> for people who have built on that history (they will need to rebase
> their commits on the rewritten history).

I did not push to any other repo yet, so this should be OK.

- Gergely

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: removing a commit from a branch
  2011-05-04  8:35 removing a commit from a branch Gergely Buday
  2011-05-04  8:45 ` Jeff King
@ 2011-05-04  9:17 ` Peter Krefting
  2011-05-04 17:53   ` Dirk Süsserott
  1 sibling, 1 reply; 8+ messages in thread
From: Peter Krefting @ 2011-05-04  9:17 UTC (permalink / raw)
  To: Gergely Buday; +Cc: git

Gergely Buday:

> I have a problematic commit in a series of commits on a branch. It
> contains adding a large binary file, which I would like to avoid to
> push to our main repository. How can I remove that from the series of
> commits? A command-line solution, please, if possible.

If the branch is simple (no merges and such), I'd use "git rebase 
--interactive branchpoint" (where "branchpoint" is where the branch is 
rooted), or "git rebase --interactive problematic^" (where "problematic" is 
the commit you want to edit, note the trailing "^" to start from its parent 
commit).

Then change the "pick" for the problematic commit to "edit", run the rebase, 
fix up the commit by using "git rm" and "git commit --amend" when it pauses, 
and then let it finish using "git rebase --continue".

"git --help rebase" for more information.

-- 
\\// Peter - http://www.softwolves.pp.se/

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: removing a commit from a branch
  2011-05-04  9:17 ` Peter Krefting
@ 2011-05-04 17:53   ` Dirk Süsserott
  2011-05-04 19:12     ` Sorry, completely off-topic. I've a mailer problem (was: Re: removing a commit from a branch) Dirk Süsserott
  0 siblings, 1 reply; 8+ messages in thread
From: Dirk Süsserott @ 2011-05-04 17:53 UTC (permalink / raw)
  To: Peter Krefting; +Cc: Gergely Buday, git

Am 04.05.2011 11:17 schrieb Peter Krefting:
> Gergely Buday:
>
>> I have a problematic commit in a series of commits on a branch. It
>> contains adding a large binary file, which I would like to avoid to
>> push to our main repository. How can I remove that from the series of
>> commits? A command-line solution, please, if possible.
>
> If the branch is simple (no merges and such), I'd use "git rebase
> --interactive branchpoint" (where "branchpoint" is where the branch is
> rooted), or "git rebase --interactive problematic^" (where "problematic"
> is the commit you want to edit, note the trailing "^" to start from its
> parent commit).
>
> Then change the "pick" for the problematic commit to "edit", run the
> rebase, fix up the commit by using "git rm" and "git commit --amend"
> when it pauses, and then let it finish using "git rebase --continue".
>
> "git --help rebase" for more information.
>

If your "problematic" commit contains only that "large file" and nothing 
else, then you'd probably like to remove the whole commit instead of 
editing it (as Peter described). Just do:

$ git rebase --interactive problematic^

Again, notice the ^ after "problematic"

An editor pops up with the history since problematic's parent, i.e. 
"problematic" is the first item in the list. Simply delete the line with 
the "problematic" commit. It should be the first line. Save the file, 
exit the editor. That's it.

     Dirk

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Sorry, completely off-topic. I've a mailer problem (was: Re: removing a commit from a branch)
  2011-05-04 17:53   ` Dirk Süsserott
@ 2011-05-04 19:12     ` Dirk Süsserott
  2011-05-04 21:28       ` Øyvind A. Holm
       [not found]       ` <4DC1B103.90007@cisco.com>
  0 siblings, 2 replies; 8+ messages in thread
From: Dirk Süsserott @ 2011-05-04 19:12 UTC (permalink / raw)
  To: git; +Cc: Dirk Süsserott

Sorry, I know, this is no Thunderbird board, but I guess other people 
use this client as well.

When I write a message, it wraps at col 72 (or so). When I see my post 
in the list, it isn't wrapped at all. Only one long line per paragraph. 
That's inconvenient for the list and I'd like to avoid that. How do YOU 
do that?

I'm using Mozilla Thunderbird 3.1.10 for Windows (which is the latest, I 
think).

Again, I'm sorry about posing such an off-topic and non-git question, 
but probably someone has the same prob (or -- even better -- has had 
resolved it).

Cheers,
     Dirk

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Sorry, completely off-topic. I've a mailer problem (was: Re: removing a commit from a branch)
  2011-05-04 19:12     ` Sorry, completely off-topic. I've a mailer problem (was: Re: removing a commit from a branch) Dirk Süsserott
@ 2011-05-04 21:28       ` Øyvind A. Holm
       [not found]       ` <4DC1B103.90007@cisco.com>
  1 sibling, 0 replies; 8+ messages in thread
From: Øyvind A. Holm @ 2011-05-04 21:28 UTC (permalink / raw)
  To: Dirk Süsserott; +Cc: git

2011/5/4 Dirk Süsserott <newsletter@dirk.my1.cc>:
> Sorry, I know, this is no Thunderbird board, but I guess other people
> use this client as well.
>
> When I write a message, it wraps at col 72 (or so). When I see my post
> in the list, it isn't wrapped at all. Only one long line per
> paragraph. That's inconvenient for the list and I'd like to avoid
> that. How do YOU do that?
>
> I'm using Mozilla Thunderbird 3.1.10 for Windows (which is the latest,
> I think).
>
> Again, I'm sorry about posing such an off-topic and non-git question,
> but probably someone has the same prob (or -- even better -- has had
> resolved it).

There is a section on how to set up Thunderbird and other mail clients
in Documentation/SubmittingPatches in the git.git repository which you
can read here:

  http://repo.or.cz/w/git.git/blob_plain/HEAD:/Documentation/SubmittingPatches

Regards,
Øyvind

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Sorry, completely off-topic. I've a mailer problem
       [not found]       ` <4DC1B103.90007@cisco.com>
@ 2011-05-05 18:59         ` Dirk Süsserott
  0 siblings, 0 replies; 8+ messages in thread
From: Dirk Süsserott @ 2011-05-05 18:59 UTC (permalink / raw)
  To: Phil Hord, "Øyvind A. Holm"; +Cc: Git Mailing List

Am 04.05.2011 22:03 schrieb Phil Hord:
> On 05/04/2011 03:12 PM, Dirk Süsserott wrote:
>> Sorry, I know, this is no Thunderbird board, but I guess other people
>> use this client as well.
>>
>> When I write a message, it wraps at col 72 (or so). When I see my post
>> in the list, it isn't wrapped at all. Only one long line per
>> paragraph. That's inconvenient for the list and I'd like to avoid
>> that. How do YOU do that?
> 
> 
> Options > Format > Plain text only
> 
> However, your emails are being sent wrapped as you see them originally.
>   But in your email headers is this line:
> 
> Content-Type: text/plain; charset=ISO-8859-1; format=flowed
> 
> The "format=flowed" is convincing Thunderbird to unwrap your lines when
> you view them in Thunderbird. The raw text of your emails look fine.
> (In Thunderbird, examine the raw email with Ctrl-U.)
> 
> More on f=f: http://joeclark.org/ffaq.html
> 
> Phil
> 

Thank you, Phil and Øyvind,

I now configured my Thunderbird to do it right (I hope). My next post
will tell ...

Dirk

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2011-05-05 18:59 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-05-04  8:35 removing a commit from a branch Gergely Buday
2011-05-04  8:45 ` Jeff King
2011-05-04  8:55   ` Gergely Buday
2011-05-04  9:17 ` Peter Krefting
2011-05-04 17:53   ` Dirk Süsserott
2011-05-04 19:12     ` Sorry, completely off-topic. I've a mailer problem (was: Re: removing a commit from a branch) Dirk Süsserott
2011-05-04 21:28       ` Øyvind A. Holm
     [not found]       ` <4DC1B103.90007@cisco.com>
2011-05-05 18:59         ` Sorry, completely off-topic. I've a mailer problem Dirk Süsserott

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 NNTP newsgroup(s).