2026年9月11日金曜日

コミットの author と committer をすべて指定したユーザで書き換える方法

コミットの author と committer をすべて指定したユーザで書き換える方法

概要

.git/config などを設定して無くグローバルの user,email を使ってしまっていた場合に全件 author と committer を書き換えたい場合があるかなと思います
その方法を紹介します

環境

  • macOS 26.6.2
  • git 2.55.0

書き換え

NEW_NAME="your_user_name"
NEW_EMAIL="your_user_email@local"

git stash push -u -m 'temp-before-identity-rewrite' && \
FILTER_BRANCH_SQUELCH_WARNING=1 git filter-branch --force --env-filter "
GIT_AUTHOR_NAME=\"$NEW_NAME\"
GIT_AUTHOR_EMAIL=\"$NEW_EMAIL\"
GIT_COMMITTER_NAME=\"$NEW_NAME\"
GIT_COMMITTER_EMAIL=\"$NEW_EMAIL\"
export GIT_AUTHOR_NAME GIT_AUTHOR_EMAIL GIT_COMMITTER_NAME GIT_COMMITTER_EMAIL
" master && \
git stash pop

確認

0 になれば OK です

git log master --format='%an%x09%ae%x09%cn%x09%ce' |
awk -F '\t' -v new_name="$NEW_NAME" -v new_email="$NEW_EMAIL" \
  '$1 != new_name || $2 != new_email || $3 != new_name || $4 != new_email { count++ }
   END { print count+0 }'

強制上書き

git push -f origin master

後処理

git update-ref -d refs/original/refs/heads/master

最後に

ちゃんと最初に .git/config は書いておきましょう

2026年9月5日土曜日

docker compose で起動したコンテナがどの作業ディレクトリで動いているか確認する方法

docker compose で起動したコンテナがどの作業ディレクトリで動いているか確認する方法

概要

docker compose でいろいろなパスで docker compose up -d していると忘れるので一覧で表示する方法を紹介します

コマンド

docker ps -q | xargs -I {} docker inspect -f '{{ index .Config.Labels "com.docker.compose.project.working_dir" }}' {}

2026年9月4日金曜日

GCP の ArtifactRegistry にある latest タグ以外のイメージを一括で削除する方法

GCP の ArtifactRegistry にある latest タグ以外のイメージを一括で削除する方法

概要

CLI を使いましょう

環境

  • macOS 26.6.2
  • gcloud cli 545.0.0

タグの一覧を表示

gcloud artifacts docker images list \
  asia-northeast1-docker.pkg.dev/product-123456/gae-standard/app/default \
  --include-tags --format='get(version,tags)'

対象のタグに絞り込む

gcloud artifacts docker images list \
  asia-northeast1-docker.pkg.dev/product-123456/gae-standard/app/default \
  --include-tags \
  --format='get(version,tags)' |
while read -r version tags; do
  if [[ "$tags" != *latest* ]]; then
    echo ${tags}
    echo ${version}
  fi
done

絞り込んだイメージを削除

gcloud artifacts docker images list \
  asia-northeast1-docker.pkg.dev/product-123456/gae-standard/app/default \
  --include-tags \
  --format='get(version,tags)' |
while read -r version tags; do
  if [[ "$tags" != *latest* ]]; then
    echo ${tags}
    echo ${version}

    gcloud artifacts docker images delete \
      "asia-northeast1-docker.pkg.dev/product-123456/gae-standard/app/default@$version" \
      --delete-tags \
      --quiet
  fi
done

最後に

プロジェクトのIDやリポジトリ名やパッケージ名は適宜変更してください

2026年9月3日木曜日

Xcode26 で ipa ファイルを作成する方法

Xcode26 で ipa ファイルを作成する方法

概要

なぜか xcode からだとエンロール関係でエラーになるので CLI を使いましょう

環境

  • macOS 26.6.2
  • Xcode 26.6 (17F113)
  • iPhone 15

事前準備

  • Xcode に無料の Developer Account でログイン
  • Xcode で開発用の証明書作成
  • iPhone 実機の接続

ビルド: app フォルダの作成

xcodebuild -workspace ios-moributa.xcworkspace \
           -scheme ios-moributa \
           -sdk iphoneos \
           -configuration Release \
           -archivePath ./build/ios-moributa.xcarchive \
           archive

アーカイブ: ipa ファイルの作成

xcodebuild -workspace ios-moributa.xcworkspace \
           -scheme ios-moributa \
           -sdk iphoneos \
           -configuration Release \
           -archivePath ./build/ios-moributa.xcarchive \
           archive

配布設定ファイルの作成

  • vim ExportOptions.plist
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://apple.com">
<plist version="1.0">
<dict>
    <key>method</key>
    <string>development</string> <!-- 開発用証明書(iOS Development)で書き出す -->
    <key>signingStyle</key>
    <string>automatic</string>
</dict>
</plist>

最後に

ワークスペース名やスキーマ名は適宜変更してください

2026年9月2日水曜日

AltStore で the data couldn’t be read because it isn’t in the correct format

AltStore で the data couldn’t be read because it isn’t in the correct format

概要

対応策を紹介します

環境

  • macOS 26.6.2
  • AltServer 1.7.2
  • AltStore 2.2.1

対応策

  • iPhone の wifi をオフにする
  • Mac と有線接続する
  • AltServer 起動
  • AltStore 起動
  • アプリの更新

最後に

macOS をアップデートすると出る気がしなくもないです