Re: [git-users] git replace
> From: Alcolo Alcolo > My job is done! > I don't need git replace any more ! Ah, great! I've integrated your changes into my copy. 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 replace
My job is done! I don't need git replace any more ! My modifications: Line 11: . "$(git --exec-path)/git-sh-setup" Adding root-commit arguments: Line 33: if [[ $# -ge 2 ]]; then mb="$2" mb=$(git rev-parse --verify "${mb}^0") || die "Does not point to a valid commit: $mb" else # Get the merge base, which is the root of the branch that we are rebasing. # (For now, ignore the question of whether there is more than one merge base.) mb=$(git merge-base "$onto" "$orig_head") fi And auto moving tags: Line after new_commit= git tag -l --points-at "$cmt" | while read T; do git tag -f "$T" "$new_commit" done Le mardi 16 septembre 2014 08:44:27 UTC+2, Alcolo Alcolo a écrit : > > > > Le lundi 15 septembre 2014 23:34:52 UTC+2, Dale Worley a écrit : >> >> > From: Alcolo Alcolo >> >> > My git history is complex and it's a nightmare to rebase from old >> commits. >> >> I'm not sure what you're attempting to do, but this might help. It's >> a rebasing script I wrote. It appears that it was based on something >> Junio wrote. The concept is that it rebases the current branch, but >> unlike the standard git-rebase, it replicates the merging structure >> between the merge-base commit and the head of the branch. (IIRC, the >> standard git-rebase creates a linear branch based on some ordering of >> the commits in the old branch.) >> >> >> Great, I'll try this script. Thank's > -- 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 replace
Le lundi 15 septembre 2014 23:34:52 UTC+2, Dale Worley a écrit : > > > From: Alcolo Alcolo > > > > My git history is complex and it's a nightmare to rebase from old > commits. > > I'm not sure what you're attempting to do, but this might help. It's > a rebasing script I wrote. It appears that it was based on something > Junio wrote. The concept is that it rebases the current branch, but > unlike the standard git-rebase, it replicates the merging structure > between the merge-base commit and the head of the branch. (IIRC, the > standard git-rebase creates a linear branch based on some ordering of > the commits in the old branch.) > > > Great, I'll try this script. Thank's -- 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 replace
> From: Alcolo Alcolo > My git history is complex and it's a nightmare to rebase from old commits. I'm not sure what you're attempting to do, but this might help. It's a rebasing script I wrote. It appears that it was based on something Junio wrote. The concept is that it rebases the current branch, but unlike the standard git-rebase, it replicates the merging structure between the merge-base commit and the head of the branch. (IIRC, the standard git-rebase creates a linear branch based on some ordering of the commits in the old branch.) Dale -- #!/bin/bash # # Copyright (c) 2010 Junio C Hamano. # Modified by Dale R. Worley. # Usage: git-rebase--merge-safe # # Rebase the current branch to commit/branch , replicating the commit # graph between HEAD and the merge base. . git-sh-setup prec=4 set -ex # Ensure the work tree is clean. require_clean_work_tree "rebase" "Please commit or stash them." onto_name=$1 onto=$(git rev-parse --verify "${onto_name}^0") || die "Does not point to a valid commit: $1" head_name=$( git symbolic-ref HEAD ) orig_head=$(git rev-parse --verify $head_name) || exit 1 echo onto=$onto echo head_name=$head_name echo orig_head=$orig_head # Get the merge base, which is the root of the branch that we are rebasing. # (For now, ignore the question of whether there is more than one merge base.) mb=$(git merge-base "$onto" "$orig_head") echo mb=$mb # Get the list of commits to rebase, which is everything between $mb and # $orig_head. # Note that $mb is not included. revisions=`git rev-list --reverse --ancestry-path $mb..$orig_head` echo revisions=$revisions # Set up the list mapping the commits on the original branch to the commits # on the branch we are creating. # Its format is ",old-hash1/new-hash1,old-hash2/new-hash2,...,". # The initial value maps $mb to $onto. map=",$mb/$onto," # Export these so git commit can see them. export GIT_AUTHOR_NAME GIT_AUTHOR_EMAIL GIT_AUTHOR_DATE # Process each commit in forward topological order. for cmt in $revisions do # Examine the commit to extract information we will need to reconstruct it. # First parent of the commit that has a mapping, i.e., is part of the # branch (and has thus been rebuilt already. first_mapped_parent= # The new commit that was made of $first_mapped_parent. first_mapped_parent_mapped= # List of -p options naming the parent commits, or their new commits if they # are in the branch. parents= # Dissect the old commit's data. # Output the commit data into FD 3. exec 3< <( git cat-file commit $cmt ) while read keyword rest <&3 do case $keyword in tree) # Ignored ;; parent) # See if the parent is mapped, i.e., is in the # original branch. if [[ "$map" == *,$rest/* ]] then # This parent has been mapped. Get the new commit. parent_mapped=${map#*,$rest/} parent_mapped=${parent_mapped%%,*} if test -z "$first_mapped_parent" then first_mapped_parent=$rest first_mapped_parent_mapped=$parent_mapped fi else # This parent has not been mapped. parent_mapped=$rest fi # $parent_mapped is a parent of the new commit. parents="$parents -p $parent_mapped" ;; author) # Extract the information about the author. GIT_AUTHOR_NAME="${rest%% <*}" GIT_AUTHOR_EMAIL="${rest##* <}" GIT_AUTHOR_EMAIL="${GIT_AUTHOR_EMAIL%%> *}" GIT_AUTHOR_DATE="${rest##*> }" ;; committer) # Ignored: The new commit will have this user's name # as committer. ;; '') # End of fixed fields, remainder is the commit comment. # Leave contents of FD 3 queued to be read later by # git commit-tree. break ;; *) # Ignore all other keywords. ;; esac done echo GIT_AUTHOR_NAME="$GIT_AUTHOR_NAME" echo GIT_AUTHOR_EMAIL="$GIT_AUTHOR_EMAIL" echo GIT_AUTHOR_DATE="$GIT_AUTHOR_DATE" echo parents="$parents" echo first_mapped_parent=$first_mapped_parent echo first_mapped_parent_mapped=$first_mapped_parent_mapped test -n "$first_mapped_parent" || exit 1 # Do the three-way merge. # Empty the index so git read-tree will merge into it. git read-tree --empty git read-tree -m --aggressive \ $first_mapped_parent $cmt $first_mapped_parent_mapped git merge-index git-merge-one-file
Re: [git-users] git replace
Le vendredi 12 septembre 2014 14:59:05 UTC+2, Dale Worley a écrit : > > > From: Alcolo Alcolo > > > > There is a way to remove all old replaced commits for ever ? > > "git gc --aggressive" works, but you have to purge all the recorded > references to old commits. The ones I know of are: > > You have to set core.logallrefupdates to 'false' to prevent logs from > containing references, and gc.pruneexpire to 'now'. And many scripts > that rewrite history leave the old head value in refs/original/..., so > you have to do something like: > > git update-ref -d refs/original/refs/heads/$BRANCH > > Dale > I know that ref logs mechanism exits that can retains against git gc. If my branch can be garbaged in the future, it's good for me, but I think not the case: because I can always run git replace -d $(git replace -l) to restore original informations. For this I think, that git keep all ancestry of hidden commits. -- 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 replace
Le vendredi 12 septembre 2014 14:53:13 UTC+2, Roman Neuhauser a écrit : > > # alco...@gmail.com / 2014-09-12 04:49:43 -0700: > > I'm using git replace command to alter ancestry of commits. > > I want to delete merged branch then I suppress the branch parent of the > > merge commit. > > > > But, I see that the old reference of replaced commits still exists. > > this reads like you should be using `git rebase` instead. > > -- > roman > My git history is complex and it's a nightmare to rebase from old commits. -- 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 replace
> From: Alcolo Alcolo > There is a way to remove all old replaced commits for ever ? "git gc --aggressive" works, but you have to purge all the recorded references to old commits. The ones I know of are: You have to set core.logallrefupdates to 'false' to prevent logs from containing references, and gc.pruneexpire to 'now'. And many scripts that rewrite history leave the old head value in refs/original/..., so you have to do something like: git update-ref -d refs/original/refs/heads/$BRANCH 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 replace
# alcol...@gmail.com / 2014-09-12 04:49:43 -0700: > I'm using git replace command to alter ancestry of commits. > I want to delete merged branch then I suppress the branch parent of the > merge commit. > > But, I see that the old reference of replaced commits still exists. this reads like you should be using `git rebase` instead. -- roman -- 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 replace
I'm using git replace command to alter ancestry of commits. I want to delete merged branch then I suppress the branch parent of the merge commit. But, I see that the old reference of replaced commits still exists. Then my branch is not deleted but hidden. I would like garbage collect it. There is a way to remove all old replaced commits for ever ? -- 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.