On Fri, 10 Jun 2016 09:03:37 -0700 (PDT)
Jack Poon <j...@atcipher.com> wrote:

> I am interested in adding a copyright notice and some meta-tagging to
> all source files and all revisions in an existing git repository.
> Essentially, creating an entire new Git repository from the old one,
> but preserving the history, change, tag, branch, etc from the old
> repository. Would appreciate if there is any pointer of how to do
> that.

Well, you need

  git filter-branch --tag-name-filter=cat --tree-filter=' ... '

encantation where the elided shell script actually updates all your
files.  That script runs in the work tree for each commit on the branch
you're rewriting and typically employs applying some text transformation
for all the files in the work tree which are of interest.

Some observations:

* `git filter-branch` only rewrites branches.
  AFAIK, there's no way to re-write "all commits" in a single run.

* The "--tag-name-filter=cat" is needed to re-create tags pointing
  to the rewritten commits of a branch being operated upon.

* Tags can be re-written individually using a simple script.

You might also look at a 3rd-party tool [1] but I personally have no
experience with it.

1. https://rtyley.github.io/bfg-repo-cleaner/

-- 
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.

Reply via email to