LoginSignup
0
0

More than 1 year has passed since last update.

gitリポジトリ整備&容量削減

Last updated at Posted at 2023-05-05

はじめに

サーバ管理する上では重要になってくるので勉強も兼ねて...

参考サイト

◆git でリポジトリを整理して容量削減するときに嵌った話 | おいもログ
 https://blog.oimo.io/2021/07/19/git-filter-repo/
  ★ここにあるgit-filter-repoの分析機能を参考に

◆windowsにgit-filter-repoをインストールする
 https://qiita.com/error484/items/6d834f2b1de133eb1fc4
  ※このサイトを参考に使えるようにする!!
◆GitHub - newren/git-filter-repo: Quickly rewrite git repository history (filter-branch replacement)
 https://github.com/newren/git-filter-repo
◆【Python】WindowsでPythonインストールしてもバージョンが出ない… Output48
 https://www.out48.com/archives/5720/

git_environment.ps1
REM gitのサブプログラムのパス確認
> git --exec-path
C:/Program Files/Git/mingw64/libexec/git-core

REM git-filter-repoの1行目変更(python3⇒python)&上記フォルダに配置

REM PATH変更
> set PATH=C:\Program Files\Python311;%PATH%

REM 分析実行(".git\filter-repo\analysis"フォルダに結果配置)
> git filter-repo --analyze

◆Gitリポジトリの総サイズを取得する方法のまとめ
 https://qiita.com/koara-local/items/07d08b099e4e81891df9

git_count-objects.ps1
REM Gitリポジトリ総サイズ取得
> git count-objects -vH

◆git repository size を削減する | DriftwoodJP
 https://www.d-wood.com/blog/2014/10/03_6965.html
  ※大きなサイズのファイルを削除する

◆gitのfor-each-refで各ブランチで最後にcommitした人とその更新時刻を一覧表示させる。 - Continue(s)
 https://taiga.hatenadiary.com/entry/2018/05/04/172538

◆gitの不要なブランチを消すコマンド
 https://qiita.com/mather314/items/a1536c52a2eb0426b2b5
  ★ローカル/リモートでそろっているので、あとで整理
◆【小ネタ】消し忘れのリモートブランチを一括表示・削除するワンライナー
 https://dev.classmethod.jp/articles/git_remove_merged_branch/
  ※オプションの詳細も解説してくれている!!

◆リポジトリのサイズを減らす | Bitbucket Cloud | アトラシアン サポート
 https://support.atlassian.com/ja/bitbucket-cloud/docs/reduce-repository-size/
  ★サイズの大きいファイルの追加を避ける
   ※大規模なファイルの無視(.gitignore)
   ※大規模なコミットのブロック(check_added_large_files)

◆Git - 環境変数
 https://git-scm.com/book/ja/v2/Git%E3%81%AE%E5%86%85%E5%81%B4-%E7%92%B0%E5%A2%83%E5%A4%89%E6%95%B0

git_count-objects.ps1
REM Git操作をトレースするための準備コマンド
> set GIT_TRACE=true
REM 処理時間の計測
> set GIT_TRACE_PERFORMANCE=true

◆WIndowsで(Linuxのfindのような)ファイル検索コマンドを使う
 https://tech.kurojica.com/archives/21461/
  ※ファイルの検索  :where
  ※ディレクトリの検索:dir

◆Git のガベージコレクションについて
 https://qiita.com/koseki/items/f1af58f1ec1693f0536a

◆git gc --aggressive したら out of memory が発生して失敗する
 https://devadjust.exblog.jp/19298790/
  ※スレッド数(デフォルト:8)を減らして成功させたとのこと 
◆git gcでUnlink of fileっていうエラーが発生 Should I try again? | urashita.com 浦下.com (ウラシタドットコム)
 https://urashita.com/archives/25850
  ※リトライすると成功するのか...

◆Gitリポジトリをメンテナンスして軽量化する
 https://qiita.com/kaneshin/items/0d19fc1cd86f931dc855
◆gitのレポジトリ容量の削減に失敗しないためのチェックポイント
 https://qiita.com/knknkn1162/items/5055daf197c3e751377f

TODO

  • git gc
  • [ ]
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0