All of lore.kernel.org
 help / color / mirror / Atom feed
* 500Mb file erroneously commited
@ 2011-06-06  7:43 Bartolomeo Nicolotti
  2011-06-06  7:51 ` Michael J Gruber
  2011-06-06  7:55 ` Axel Freyn
  0 siblings, 2 replies; 4+ messages in thread
From: Bartolomeo Nicolotti @ 2011-06-06  7:43 UTC (permalink / raw)
  To: git

Hello,

we're using CVS to store some sources, but for some big projects I'm considering
to use git. Last week it has happened that one collegue erroneously commited one
big file, 500Mb the file only. To avoid to have this file in the repository
we've deleted the history file in the CVS repository, the one with ,v, this has
been easy as each file has its own history. Would it be possible to do the same
with git, or there's no possibility to delete a 500Mb file erroneously commited? 

Many thanks

Best regards

Bartolomeo

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

* Re: 500Mb file erroneously commited
  2011-06-06  7:43 500Mb file erroneously commited Bartolomeo Nicolotti
@ 2011-06-06  7:51 ` Michael J Gruber
  2011-06-06  7:55 ` Axel Freyn
  1 sibling, 0 replies; 4+ messages in thread
From: Michael J Gruber @ 2011-06-06  7:51 UTC (permalink / raw)
  To: Bartolomeo Nicolotti; +Cc: git

Bartolomeo Nicolotti venit, vidit, dixit 06.06.2011 09:43:
> Hello,
> 
> we're using CVS to store some sources, but for some big projects I'm considering
> to use git. Last week it has happened that one collegue erroneously commited one
> big file, 500Mb the file only. To avoid to have this file in the repository
> we've deleted the history file in the CVS repository, the one with ,v, this has
> been easy as each file has its own history. Would it be possible to do the same
> with git, or there's no possibility to delete a 500Mb file erroneously commited? 

Due to the way git (or hg or...) works, you would have to rewrite the
history in order to remove a file from a repo completely. The first
example in the git-filter-branch man page describes how to do this.

Michael

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

* Re: 500Mb file erroneously commited
  2011-06-06  7:43 500Mb file erroneously commited Bartolomeo Nicolotti
  2011-06-06  7:51 ` Michael J Gruber
@ 2011-06-06  7:55 ` Axel Freyn
  2011-06-06  9:10   ` Matthieu Moy
  1 sibling, 1 reply; 4+ messages in thread
From: Axel Freyn @ 2011-06-06  7:55 UTC (permalink / raw)
  To: git

On Mon, Jun 06, 2011 at 07:43:20AM +0000, Bartolomeo Nicolotti wrote:
> Hello,
> 
> we're using CVS to store some sources, but for some big projects I'm considering
> to use git. Last week it has happened that one collegue erroneously commited one
> big file, 500Mb the file only. To avoid to have this file in the repository
> we've deleted the history file in the CVS repository, the one with ,v, this has
> been easy as each file has its own history. Would it be possible to do the same
> with git, or there's no possibility to delete a 500Mb file erroneously commited? 
Hi,

yes, you can. In fact, there are at least two situation:
 - if you detect the error DIRECTLY after the commit (and have no other
   commits on top of it), then a
   git rm bigfile
   git commit --amend
   does the trick (well, the big file will be unused now, and be deleted
   by the next "git gc")
 - if you have already other commit's on top of it, you can use e.g.
   "git rebase" in order to redefine the history... something like (I'm
   not sure it works exactly like that, but in principle)
   git checkout -b tmp <WRONG_COMMIT>
   git rm bigfile
   git commit --amend
   git checkout master
   git rebase tmpfix
   git branch -d tmpfix

   
However, there if your tree has been already shared with other
developers, they also will have to change to the new and corrected
branch.

Axel

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

* Re: 500Mb file erroneously commited
  2011-06-06  7:55 ` Axel Freyn
@ 2011-06-06  9:10   ` Matthieu Moy
  0 siblings, 0 replies; 4+ messages in thread
From: Matthieu Moy @ 2011-06-06  9:10 UTC (permalink / raw)
  To: git

Axel Freyn <axel-freyn@gmx.de> writes:

>  - if you have already other commit's on top of it, you can use e.g.
>    "git rebase" in order to redefine the history... something like (I'm
>    not sure it works exactly like that, but in principle)
>    git checkout -b tmp <WRONG_COMMIT>
>    git rm bigfile
>    git commit --amend
>    git checkout master
>    git rebase tmpfix
>    git branch -d tmpfix

That should work, but "git rebase -i" will make it much simpler (just
"edit" or even delete the guilty commit).

-- 
Matthieu Moy
http://www-verimag.imag.fr/~moy/

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

end of thread, other threads:[~2011-06-06  9:10 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-06-06  7:43 500Mb file erroneously commited Bartolomeo Nicolotti
2011-06-06  7:51 ` Michael J Gruber
2011-06-06  7:55 ` Axel Freyn
2011-06-06  9:10   ` Matthieu Moy

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.