특정 history 삭제 / 어떻게 git 에서 특정 commit 삭제
git 에서 size 가 100mb 가 넘는 commit 삭제 방법
다음 2가지 tool 로 삭제를 할 수 있다고 한다.
- BFG Repo-Cleaner by rtyley
- git filter-repo tool
여기서는 “BFG Repo-Cleaner” 를 사용한 내용이다.
git clone --mirror https://bitbucket.org/andbut/some-big-repo.git
java -jar bfg-1.14.0.jar --strip-blobs-bigger-than 100M some-big-repo.git
cd some-big-repo.git
git reflog expire --expire=now --all && git gc --prune=now --aggressive
git push
full log
c:\myproj>git clone --mirror https://bitbucket.org/andbut/mystartproj.git
Cloning into bare repository 'mystartproj.git'...
remote: Enumerating objects: 13760, done.
remote: Counting objects: 100% (13760/13760), done.
remote: Compressing objects: 100% (5717/5717), done.
remote: Total 13760 (delta 7249), reused 9159 (delta 4671), pack-reused 0
Receiving objects: 100% (13760/13760), 24.34 MiB | 1.44 MiB/s, done.
Resolving deltas: 100% (7249/7249), done.
c:\myproj>java -jar bfg-1.14.0.jar --strip-blobs-bigger-than 100M mystartproj.git
Using repo : c:\myproj\mystartproj.git
Scanning packfile for large blobs: 13760
Scanning packfile for large blobs completed in 140 ms.
Found 1 blob ids for large blobs - biggest=138782059 smallest=138782059
Total size (unpacked)=138782059
Found 201 objects to protect
Found 34 commit-pointing refs : HEAD, refs/heads/test_by_mm, refs/heads/add_app_config, ...
Found 27 tag-pointing refs : refs/tags/v1.1, refs/tags/v1.1.202201011300, refs/tags/v1.1.202201031100, ...
Protected commits
-----------------
These are your protected commits, and so their contents will NOT be altered:
* commit 4aeabe54 (protected by 'HEAD')
Cleaning
--------
Found 1125 commits
Cleaning commits: 100% (1125/1125)
Cleaning commits completed in 4,218 ms.
Updating 44 Refs
----------------
Ref Before After
----------------------------------------------------------
refs/heads/test_by_mm | 27c58589 | 8aad8172
refs/heads/add_app_config | 7970a6f2 | 3c70ed16
refs/heads/bookmark | 2d846104 | 48fbb0a7
refs/heads/del_print | 3dddf3db | 63a93074
refs/heads/dev_mm | ba858dda | f06aafc8
refs/heads/feat_alias | 71664630 | 43f10c0d
refs/heads/feat_heatmap | 5df3255d | 83695be7
refs/heads/feat_view_list | 9d819f80 | e97502b0
refs/heads/feature/wip | e5b7fac5 | b989cfe8
refs/heads/master | 4aeabe54 | 1fa5f1d7
refs/heads/mylocaldev | a717d63f | 960fc42a
refs/heads/re_project | 94f9ff8d | 75a5d519
refs/heads/ssbb | bf094b43 | 5a1c9417
refs/heads/test_screenshot_on_window | 20c74ecb | 1df319dd
refs/heads/mm | d71ec17f | 9cef257b
...
Updating references: 100% (44/44)
...Ref update completed in 274 ms.
Commit Tree-Dirt History
------------------------
Earliest Latest
| |
.......................DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDmmmmm
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 | dcd1265f | 6f242b33
Last dirty commit | 5ff1939e | 315af4a4
Deleted files
-------------
Filename Git id
------------------------------
test | f692e074 (132.4 MB)
In total, 2544 object ids were changed. Full details are logged here:
c:\myproj\mystartproj.git.bfg-report\2022-07-05\09-19-36
BFG run is complete! When ready, run: git reflog expire --expire=now --all && git gc --prune=now --aggressive
c:\myproj>cd mystartproj.git
c:\myproj\mystartproj.git>git reflog expire --expire=now --all && git gc --prune=now --aggressive
Enumerating objects: 13760, done.
Counting objects: 100% (13760/13760), done.
Delta compression using up to 8 threads
Compressing objects: 100% (10387/10387), done.
Writing objects: 100% (13760/13760), done.
Selecting bitmap commits: 1035, done.
Building bitmaps: 100% (115/115), done.
Total 13760 (delta 7334), reused 4628 (delta 0), pack-reused 0
c:\myproj\mystartproj.git>git push
Enumerating objects: 76, done.
Counting objects: 100% (76/76), done.
Writing objects: 100% (9407/9407), 3.15 MiB | 828.00 KiB/s, done.
Total 9407 (delta 76), reused 76 (delta 76), pack-reused 9331
remote: Resolving deltas: 100% (5160/5160), completed with 29 local objects.
remote: Checking connectivity: 8196, done.
To https://bitbucket.org/andbut/mystartproj.git
+ 27c5858...8aad817 test_by_mm -> test_by_mm (forced update)
+ 7970a6f...3c70ed1 add_app_config -> add_app_config (forced update)
+ 2d84610...48fbb0a bookmark -> bookmark (forced update)
+ 3dddf3d...63a9307 del_print -> del_print (forced update)
+ ba858dd...f06aafc dev_mm -> dev_mm (forced update)
+ 7166463...43f10c0 feat_alias -> feat_alias (forced update)
+ 5df3255...83695be feat_heatmap -> feat_heatmap (forced update)
+ 9d819f8...e97502b feat_view_list -> feat_view_list (forced update)
+ e5b7fac...b989cfe feature/wip -> feature/wip (forced update)
+ 4aeabe5...1fa5f1d master -> master (forced update)
+ a717d63...960fc42 mylocaldev -> mylocaldev (forced update)
+ 94f9ff8...75a5d51 re_project -> re_project (forced update)
+ bf094b4...5a1c941 ssbb -> ssbb (forced update)
+ 20c74ec...1df319d test_screenshot_on_window -> test_screenshot_on_window (forced update)
+ d71ec17...9cef257 mm -> mm (forced update)
+ 590949c...0936486 mm_dev -> mm_dev (forced update)
+ 897505e...021becf mm_test -> mm_test (forced update)
+ 18fafe2...cf54039 v1.1 -> v1.1 (forced update)
+ 889cc53...779c18e v1.1.202201011300 -> v1.1.202201011300 (forced update)
+ 1da5896...53554ac v1.1.202201031100 -> v1.1.202201031100 (forced update)
+ 2b24265...39325ef v1.1.202201071900 -> v1.1.202201071900 (forced update)
+ 9ec1e6d...285ed0d v1.1.202201120000 -> v1.1.202201120000 (forced update)
+ fe90ad9...e4ca019 v1.1.202201142300 -> v1.1.202201142300 (forced update)
+ 69439b0...26c3c0f v1.1.202201171400 -> v1.1.202201171400 (forced update)
+ 8281800...20dffe2 v1.1.202201221100 -> v1.1.202201221100 (forced update)
+ b1023ac...9c07b91 v1.1.202201290900 -> v1.1.202201290900 (forced update)
+ 6e9948a...44ee73e v1.1.202201291100 -> v1.1.202201291100 (forced update)
+ 71981bc...42e6129 v1.1.202202031600 -> v1.1.202202031600 (forced update)
+ 5007b82...ad9c8bb v1.1.202202071800 -> v1.1.202202071800 (forced update)
+ 9f60248...34d9669 v1.1.202202090900 -> v1.1.202202090900 (forced update)
+ 814c252...404d166 v1.1.202202121100 -> v1.1.202202121100 (forced update)
+ 4ac69b7...90ca513 v1.1.202202141100 -> v1.1.202202141100 (forced update)
+ d5b496e...cc81cf6 v1.1.202202201100 -> v1.1.202202201100 (forced update)
+ dd49c55...014437f v1.1.202202261800 -> v1.1.202202261800 (forced update)
+ 8351ed7...9ea31ba v1.1.202202281100 -> v1.1.202202281100 (forced update)
+ eaf1dff...5078309 v1.1.202203021600 -> v1.1.202203021600 (forced update)
+ 054b8aa...6887bd1 v1.1.202203070800 -> v1.1.202203070800 (forced update)
+ afeb103...26b39bb v1.1.202203111900 -> v1.1.202203111900 (forced update)
+ 5db3c9c...b3da92b v1.1.202203262300 -> v1.1.202203262300 (forced update)
+ af451fa...9fd56ba v1.1.202204031200 -> v1.1.202204031200 (forced update)
+ 8081762...321d5aa v1.1.202204110900 -> v1.1.202204110900 (forced update)
+ 9b5669e...37f12e1 v1.1.202204161700 -> v1.1.202204161700 (forced update)
+ baf3162...592b981 v1.1.202204260900 -> v1.1.202204260900 (forced update)
+ 6b41d3c...fe48ced v1.1.202205091000 -> v1.1.202205091000 (forced update)
c:\myproj\mystartproj.git>
댓글 없음:
댓글 쓰기