Hello,

I have to update frequently a mirror of a git repository on Github.
In the meantime, I created branches following a specific pattern (let's say 
foo-[1-9]+[0-9]*) on my local mirror.
These branches were created at a given tag and contains internal patches.

I would like to update my mirror frequently and get an exact copy of 
Github's repository + the branches containing internal patches.

At the time I created the mirror, let's assume the state of Github's 
repository is the below:


      C---D branchA
     /
A---B---E---F master
        \
         G---H branchB

v0.1 --> F
 

We use the software at tag *v0.1* and we created patches for some reasons 
to fix the build or the software. The state of the local repository is now:

      C---D branchA
     /
A---B---E---F master
        \   \
         \   I---J foo-1
          \
           G---H branchB

v0.1 --> F
foo-1 has been created and host patches for v0.1
 

In the meantime, new commits, branches appeared on Github and development 
branches were merged and then deleted. The state of Github's repository is 
now :

                          J'---K branchC
                         /
A---B---E---F---C---D---I' master
            \
             G---H branchB

v0.1 --> F
v0.2 --> D
branchB has been rebased
branchC has been created
branchA has been merged into master and then deleted
 

At first I clone the mirror.

git clone --mirror ${url_local_repo}


Then I add Github's repository as remote.

git remote add --mirror=fetch github ${url_github_repo}


Finally I fetch the changes from github.

git fetch --tags --prune github
   From ${url_github_repo}
    x [deleted]         (none)     -> branchA
    x [deleted]         (none)     -> foo-1
    * [new branch]      branchC    -> branchC
    E..F                branchB    -> branchB
    F..I'               master     -> master
 

foo-1 is deleted but I want to keep it.

I tried to screen the fetch using glob (see 10.5 Git Internals - The Refspec 
<https://git-scm.com/book/en/v2/Git-Internals-The-Refspec>) syntax but it 
does not work.

git fetch --dry-run --prune github '+refs/heads/*:refs/heads/[!f]*'
fatal: Invalid refspec '+refs/heads/*:refs/heads/[!f]*'
 

What would you suggest ?

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