[Python] git-filter-repo loses the remotes

Discussão em 'Python' iniciado por Stack, Setembro 4, 2025.

  1. Stack

    Stack Membro Participativo

    I previously got this rewrite of history commit messages to work:

    #!/bin/bash

    # Create a temporary file to store the commit messages
    temp_file=$(mktemp)

    main_head_hash=$(git rev-parse main)
    suffix="⚠️ rebased since!"
    # Use git log to retrieve the commit messages and store them in the temporary file
    git log --pretty=format:%s $main_head_hash.. | grep ' build version' | grep -v "$suffix" > $temp_file

    # Create a file to store the replacements
    echo > replacements.txt

    # Iterate over the commit messages in the temporary file
    while read commit_message; do
    # Print the replacement message to the replacements.txt file
    echo "$commit_message==>$commit_message $suffix" >> replacements.txt
    done < $temp_file

    # # ⚠️⚠️ Rewriting history ⚠️⚠️
    git filter-repo --replace-message replacements.txt --force

    # # Remove the temporary files
    rm $temp_file
    rm replacements.txt


    but I have no began to notice that it causes my git repo to lose the remotes setup. Af first I thought it was some other git tool I was using, but now I have this script being the suspect ️

    How do I avoid losing the remotes?

    Continue reading...

Compartilhe esta Página