Re: [git-users] git-filter-branch : How to filter all commits from an given commit ?

2014-10-27 Thread Alcolo Alcolo

My question is "how can I do" and you answer is "why you do this".

My main question is:
git-filter-branch allow to select commits to filter. How can I select all 
commits from a given commit C, including C?
This question can be declined for git-rev-list.

This question has no meaning ??

I can do the job with git filter-branch -- --all, but this will takes hours 
to change only ~50 last commits.
I just want to know how this can be optimized.


Le vendredi 24 octobre 2014 22:32:39 UTC+2, Dale Worley a écrit :
>
> Actually, git-filter-branch is "based on git-rev-list etc." 
>
The purpose of git-filter-branch, though, is to be able to apply a 
> complicated transformation to every commit in the branch, usually the 
> uniform removal of particular paths from the file tree.

No, changing commit date or authors is not a "complicated" transformation.
 

>  What you seem 
> to be wanting to do is modify a commit (although I'm not clear whether 
> you simply want to change the meta-data or whether you want to also 
> change the file content), and then have that propagated through all of 
> the descendant commits (at least in their hashes, and possibly in 
> their file content).

(I want changing something in one commit object: meta-data, that's can 
include change of tree-id: file contents (changing tree-id is not my goal)) 

>  That job isn't really the purpose of 
> git-filter-branch, because in what you want, the changes to the 
> descendant commits are only due to propagatation from the changes in 
> C. 
>
Yes it is: since git-filter-branch is the only way to integrate git-replace 
or grafts changes definitively,
git-filter-branch purpose is to rehash commits.
 

>
> But why are you, of all people, asking about this?  You've used 
> git-rebase--merge-safe, which does this sort of task.  You've even 
> *improved* it. 
>
git-rebase--merge-safe:
- it rehash commits: git-filter-branch jobs
- it merge changes like git rebase, it is its main goal: but I don't need 
this, it's not my goal.

>
> Dale 
>

-- 
You received this message because you are subscribed to the Google Groups "Git 
for human beings" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to git-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [git-users] git-filter-branch : How to filter all commits from an given commit ?

2014-10-24 Thread Dale R. Worley
> From: Alcolo Alcolo 

> Because C can be a base commit of branches and merges, then it's a 
> nightmare to rebase.
> 
> I know that scripts exists to rebase merges (based on git-rev-list, 
> git-cat-file, git-hash-object/git-commit-tree), but those scripts redo the 
> git-filter-branch job.

Actually, git-filter-branch is "based on git-rev-list etc."

The purpose of git-filter-branch, though, is to be able to apply a
complicated transformation to every commit in the branch, usually the
uniform removal of particular paths from the file tree.  What you seem
to be wanting to do is modify a commit (although I'm not clear whether
you simply want to change the meta-data or whether you want to also
change the file content), and then have that propagated through all of
the descendant commits (at least in their hashes, and possibly in
their file content).  That job isn't really the purpose of
git-filter-branch, because in what you want, the changes to the
descendant commits are only due to propagatation from the changes in
C.

But why are you, of all people, asking about this?  You've used
git-rebase--merge-safe, which does this sort of task.  You've even
*improved* it.

Dale

-- 
You received this message because you are subscribed to the Google Groups "Git 
for human beings" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to git-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [git-users] git-filter-branch : How to filter all commits from an given commit ?

2014-10-24 Thread Alcolo Alcolo
Because C can be a base commit of branches and merges, then it's a 
nightmare to rebase.

I know that scripts exists to rebase merges (based on git-rev-list, 
git-cat-file, git-hash-object/git-commit-tree), but those scripts redo the 
git-filter-branch job.


Honestly, I'm not really capable of dealing with your problem as stated 
> but is there really a reason you can't or don't want to use 
>
>   git rebase -i C~1 
>
> amending the commit C and letting Git take care of the rest? 
>

-- 
You received this message because you are subscribed to the Google Groups "Git 
for human beings" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to git-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [git-users] git-filter-branch : How to filter all commits from an given commit ?

2014-10-23 Thread Konstantin Khomoutov
On Thu, 23 Oct 2014 01:36:11 -0700 (PDT)
Alcolo Alcolo  wrote:

> I want to change something to only one commit C:
> I can do
> git filter-branch --X-filter 'test $GIT_COMMIT = CHash &&
> do-something' 
> -- --all
> But it's an useless heavy work: only descendants of C (including C)
> need to be scanned.
[...]

Honestly, I'm not really capable of dealing with your problem as stated
but is there really a reason you can't or don't want to use

  git rebase -i C~1

amending the commit C and letting Git take care of the rest?

-- 
You received this message because you are subscribed to the Google Groups "Git 
for human beings" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to git-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[git-users] git-filter-branch : How to filter all commits from an given commit ?

2014-10-23 Thread Alcolo Alcolo
I want to change something to only one commit C:
I can do
git filter-branch --X-filter 'test $GIT_COMMIT = CHash && do-something' 
-- --all
But it's an useless heavy work: only descendants of C (including C) need to 
be scanned.

The idea is to change C by replacing it (git replace -i C) and re-hash C an 
all its descendants to permanently incorporate changes. 

The better way I found to scan all commits from C *including C* is:
git filter-branch ^C^1 --all --ancestry-path
But:

   1. I don't understand why this command works because --all and 
   --anscetry-path is not documented options of git-filter-branch but 
   git-rev-list's options. (there is no -- in my command line)
   2. Other children of C^ will be scanned
   3. When filter-branch looks for non-related branch, warnings are 
   displayed.
   4. Don't work if C is an initial commit

Another alternative way:
git filter-branch -- $(git branch --contains C | cut -b3-) --not C^@

But:

   1. Tags are not moved to new commits
   2. Don't work if C is an initial commit


Any ideas ?

I'm using git 2.1.1

-- 
You received this message because you are subscribed to the Google Groups "Git 
for human beings" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to git-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.