2

すべてのブランチからフォルダー キャッシュを削除する必要があります。BFG ツールを使用していますが、master 以外のすべてのブランチが削除されます。これが私がすることです。

ステップ 1: ローカル クローンからミラーを作成します (ローカル クローンに多くのブランチがあることを確認します)。

myuser:~/Repositories$ cd test.git
myuser:~/Repositories/test.git$ git --bare init
Initialized empty Git repository in /home/saman/Repositories/test.git/
myuser:~/Repositories/test.git$ cd ../originalrepo
myuser:~/Repositories/originalrepo$ git push -u origin --all
Counting objects: 21103, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (8071/8071), done.
Writing objects: 100% (21103/21103), 1.84 GiB | 30.50 MiB/s, done.
Total 21103 (delta 13017), reused 21101 (delta 13015)
To ../test.git
 * [new branch]      idio-additive -> idio-additive
 * [new branch]      idiosyncratic -> idiosyncratic
 * [new branch]      lazy -> lazy
 * [new branch]      list -> list
 * [new branch]      master -> master
 * [new branch]      retake -> retake
 * [new branch]      variance -> variance
Branch idio-additive set up to track remote branch idio-additive from origin.
Branch idiosyncratic set up to track remote branch idiosyncratic from origin.
Branch lazy set up to track remote branch lazy from origin.
Branch list set up to track remote branch list from origin.
Branch master set up to track remote branch master from origin.
Branch retake set up to track remote branch retake from origin.
Branch variance set up to track remote branch variance from origin.

ステップ 2: ミラー上で BFG ツールを実行する

myuser:~/Repositories/originalrepo$ cd ..
myuser:~/Repositories$ java -jar bfg.jar test.git --delete-folders cache

Using repo : /home/saman/Repositories/test.git

Found 435 objects to protect
Found 8 commit-pointing refs : HEAD, refs/heads/idio-additive, refs/heads/idiosyncratic, ...

Protected commits
-----------------

These are your protected commits, and so their contents will NOT be altered:

 * commit fe37396b (protected by 'HEAD') - contains 284 dirty files : 
    - cache/steadyState_00504943e81e98a199dfe851738dc15bd31eaddba3dd76c81a99d3ff (300.7 KB)
    - cache/steadyState_05fabdf818d4dc580e4ffb4a2769439ab31c20d6f776a52f39f4c175 (300.7 KB)
    - ...

WARNING: The dirty content above may be removed from other commits, but as
the *protected* commits still use it, it will STILL exist in your repository.

Details of protected dirty content have been recorded here :

/home/saman/Repositories/test.git.bfg-report/2016-06-06/14-21-39/protected-dirt/

If you *really* want this content gone, make a manual commit that removes it,
and then run the BFG on a fresh copy of your repo.


Cleaning
--------

Found 668 commits
Cleaning commits:       100% (668/668)
Cleaning commits completed in 564 ms.

Updating 7 Refs
---------------

    Ref                        Before     After   
    ----------------------------------------------
    refs/heads/idio-additive | 2efcf23c | 644b46bf
    refs/heads/idiosyncratic | 581b1c65 | 67ba6839
    refs/heads/lazy          | 065720e5 | 5b7a5327
    refs/heads/list          | 6bf819c0 | 0aa8b0a5
    refs/heads/master        | fe37396b | cea32db5
    refs/heads/retake        | c94a42d8 | 5194e362
    refs/heads/variance      | 3c3c62d8 | f47432bf

Updating references:    100% (7/7)
...Ref update completed in 22 ms.

Commit Tree-Dirt History
------------------------

    Earliest                                              Latest
    |                                                          |
    ...........DDmmmmDDDDDDDDDDDDDDDDDmmDDDDDDDDDDDDDDDDDDDDDDDD

    D = dirty commits (file tree fixed)
    m = modified commits (commit message or parents changed)
    . = clean commits (no changes to file tree)

                            Before     After   
    -------------------------------------------
    First modified commit | 00d79c52 | b5d26c37
    Last dirty commit     | 2efcf23c | 644b46bf


In total, 912 object ids were changed. Full details are logged here:

    /home/saman/Repositories/test.git.bfg-report/2016-06-06/14-21-39

BFG run is complete! When ready, run: git reflog expire --expire=now --all && git gc --prune=now --aggressive

Has the BFG saved you time?  Support the BFG on BountySource:  


myuser:~/Repositories$ cd test.git
myuser:~/Repositories/test.git$ git reflog expire --expire=now --all && git gc --prune=now --aggressive
Counting objects: 3829, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (3812/3812), done.
Writing objects: 100% (3829/3829), done.
Total 3829 (delta 2460), reused 838 (delta 0)

ステップ 3: 変更されたミラーからクローンを作成し、ブランチの数を数えます

myuser:~/Repositories$ git clone test.git
Cloning into 'test'...
done.
myuser:~/Repositories$ cd test
myuser:~/Repositories/test$ git branch
* master
4

1 に答える 1

1

ブランチはリンクされていません。git branch -aすべてのブランチを表示し、使用して必要なものを追加できますgit checkout -b branchname remote/branchname

于 2016-06-06T14:16:47.147 に答える