Skip to content

Wrdn28/auto_push_tool

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 

Repository files navigation

🚀 Auto Push & Delete Branch Tool

Auto Push & Delete Branch Tool is a Python script that automates managing multiple Git repositories — perfect for large Android-based projects such as AOSP, or LineageOS that contain dozens or even hundreds of repositories.


⚙️ Key Features

  • 🌐 Dual language support: English & Indonesian
  • ⚡ Easy configuration via .env
  • 🔗 Supports local → remote repo mapping (local_folder:github_repo)
  • 🏗️ Automatically creates repositories on GitHub if missing
  • 🧹 Filters large files (>100MB) using git-filter-repo
  • 📦 Batch push for large repositories
  • 🗑️ Delete branches across multiple repositories
  • 🧾 Saves detailed logs to push_log.txt

🧰 Requirements

  1. Install Python dependencies

    pip install requests PyGithub
  2. Ensure system tools are installed

    • git
    • wget
    • git-filter-repo (auto-installed if missing)

⚙️ .env Configuration

Create a file named .env in the same folder as the script and add the following:

BASE_DIR=/home/ubuntu/orion
REPO_LIST_FILE=repos.txt
BRANCH=bka
GITHUB_USERNAME=Wrdn28
GITHUB_TOKEN=ghp_your_github_token_here
GITHUB_ORG=OrionOS-Project
LOG_FILE=push_log.txt
BATCH_SIZE=50000

🧩 Variable Description

Variable Description
BASE_DIR Root folder containing all local repositories
REPO_LIST_FILE File containing the list of repositories
BRANCH Branch name to push or delete
GITHUB_USERNAME Your GitHub username
GITHUB_TOKEN Your GitHub Personal Access Token
GITHUB_ORG GitHub organization name (leave blank if personal)
LOG_FILE Log file name
BATCH_SIZE Number of commits per push batch

📄 repos.txt Format

The repos.txt file lists all repositories to be processed.
Each line represents a local folder, optionally mapped to a different GitHub repo name using :.

Example:

android:manifest
build_make:build
frameworks_base

Explanation:

  • android:manifest → local folder android, GitHub repo manifest
  • build_make:build → local folder build_make, GitHub repo build
  • frameworks_base → same name locally and remotely

🚀 How to Run

Run the script with:

python3 auto_push.py

You’ll be asked to choose:

1️⃣ Language

Select language / Pilih bahasa:
1. English
2. Bahasa Indonesia

2️⃣ Mode

Select mode:
1. Auto Push
2. Delete Branch

🔹 Auto Push Mode

This mode will:

  • Filter large files (>100MB) — applies only to frameworks_base
  • Create the target branch if it doesn’t exist
  • Auto-commit local changes
  • Create GitHub repos if missing
  • Push using batch system
  • Perform a final push for remaining commits

Example Output:

⚙️ Filtering files larger than 100MB...
✅ Repository frameworks_base fully pushed!

🔹 Delete Branch Mode

This mode will:

  • Ask for the branch name to delete
  • Remove that branch from all repos in repos.txt

Example Output:

=== Deleting Branch: main ===
🔍 Processing repo: frameworks_base
✅ Branch 'main' deleted from frameworks_base.
⚠️ Branch 'main' not found in vendor_lineage. Skipped.
=== Branch Deletion Complete ===

🧠 Notes

  • Ensure each folder in BASE_DIR is a valid Git repository (.git/ exists).
  • Missing folders will be skipped automatically.
  • All logs are saved to push_log.txt.
  • Only repositories listed in repos.txt are affected.

🧾 License

Developed by Hirokixd (Wrdn28)
Free to use, modify, and redistribute — attribution required.


About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages