git - Autofixup consecutive commits of same message and author (of the complete repo) -


I have transferred a large SVN repository to GIT and there are several drawbacks with the same message from the same author. / P>

Now I want to command myself in a single commitment.

Thoughts?

I was finally able to annoy the problem, as always, it was a human error.

I've written the script available here for Bash, but as I use it should not be a problem.

This script is, I will explain it in detail below:

  #! / Bin / bash Author = "$ GIT_AUTHOR_NAME & lt; $ GIT_AUTHOR_EMAIL & gt;" Msg = "$ (cat)" tree = "$ 1" parent = () change in time of change ": p:" opt. What to do $ opt in p) Parent = ($ {parent] $ OPTARG ;;?) Echo "invalid option: - $ OPTARG" & gt; And 2 exit 1 ;; ASAC has created _parents_pection () {For parents = "$ @" Do_author () {git log -1 - format = "% AN & lieutenant" = "- p $ parent";% AE> "$ 1} Squash_it () {If ["x $ author" == "x $ (get_author $ 1)"] & amp; Amp; ["X $ msg" == "x $ (get_msg $ 1)"]; Then git read-tree -m - offensive $ {1} ^ {tree} $ tree & gt; / Dev / null tree = $ (git write-tree) = parent = ($ (git log-format =% p-1 $ 1)) FI} if [[$ $ # parents [@]} == 1]]; Then squash_armmit $ {parent} [0]} commit-tree $ tree $ (create_parents_option $ {parent-father [@]} -m "$ msg"   

You can execute through:

  GIT filter-branch --Amet-filter "$ (cat / path / to / d / script)"   

The script will be checked that the current commitment was made with the same author and the same message as before.

If it is so, then it will merge the current commitment tree, before using the git read-tree -m merge into trees given with the change and Writes the result in the index. Later, git write-tree is used to create a new tree with the merged results on the index.

Then set the script to the parent of the current comment on the parents of the parent of the comment merged, effectively removing this "deletion" from history.

If you have any more questions then I'm happy to help. It was fun to work on!

Edit: I have tested this script with msysgit version 1.9.2 on Windows 7.

Comments

Popular posts from this blog

php - PDO bindParam() fatal error -

logging - How can I log both the Request.InputStream and Response.OutputStream traffic in my ASP.NET MVC3 Application for specific Actions? -

java - Why my included JSP file won't get processed correctly? -