GithubHelp home page GithubHelp logo

Comments (8)

MartinThoma avatar MartinThoma commented on July 21, 2024 2

The history re-write is done. Please clone from the current repository

from basic-computer-games.

coding-horror avatar coding-horror commented on July 21, 2024 2

OK! I cloned the repo from scratch and it looks good to me! Thank you!

from basic-computer-games.

MartinThoma avatar MartinThoma commented on July 21, 2024 1

If I should do it, I would give @AlaaSarhan time until Monday to finish #404 . If possible, I would like to prevent open PRs.

Should I do it? Does it sound good to wait until #404 is merged / Monday (whatever is earlier)?

from basic-computer-games.

coding-horror avatar coding-horror commented on July 21, 2024 1

Sure! Sounds good to me.

from basic-computer-games.

coding-horror avatar coding-horror commented on July 21, 2024

from basic-computer-games.

MartinThoma avatar MartinThoma commented on July 21, 2024

Git History Rewrite

I propose to do the following:

  1. Clarify if we need the buildJvm directory (discussion) and maybe adjust what gets deleted from the git history
  2. Merge all current branches - or ask the people to copy their changes
  3. Delete all local branches: git branch -D $(git branch)
  4. Create backup: git bundle create backup.bundle --all
  5. Rewrite the history (see below - I recommend the automatic way with this list of files to delete)
  6. Clean up git repo: git gc --aggressive --prune=now
  7. Force-push!!!! Now everybody needs to fork / clone again! ⚠️
  8. Ask contributors to (1) delete their fork / repository (2) fork again (3) clone again

Maybe we should also disable force-pushes on main after that in the Github settings?

History Rewrite Option 1: Manual

git filter-branch --prune-empty -d /dev/shm/scratch \
  --index-filter "git rm --cached -f --ignore-unmatch '39 Golf/csharp/compiled/windows_x86/golf.exe'" \
  --tag-name-filter cat -- --all

git filter-branch -f --prune-empty -d /dev/shm/scratch \
  --index-filter "git rm --cached -f --ignore-unmatch '39 Golf/csharp/compiled/linux_x86/golf'" \
  --tag-name-filter cat -- --all

git filter-branch -f --prune-empty -d /dev/shm/scratch \
  --index-filter "git rm --cached -f --ignore-unmatch '89_Tic-Tac-Toe/python/TicTacToe_exe/TicTacToe.exe'" \
  --tag-name-filter cat -- --all

git filter-branch -f --prune-empty -d /dev/shm/scratch \
  --index-filter "git rm --cached -f --ignore-unmatch '53_King/kotlin/king.jar'" \
  --tag-name-filter cat -- --all

git filter-branch -f --prune-empty -d /dev/shm/scratch \
  --index-filter "git rm --cached -f --ignore-unmatch 'buildJvm/build_53_King_kotlin/build/install/build_53_King_kotlin/lib/kotlin-stdlib-1.6.0.jar'" \
  --tag-name-filter cat -- --all

git filter-branch -f --prune-empty -d /dev/shm/scratch \
  --index-filter "git rm --cached -f --ignore-unmatch '08 Batnum/vbnet/.vs/batnum/DesignTimeBuild/.dtbcache.v2'" \
  --tag-name-filter cat -- --all

git filter-branch -f --prune-empty -d /dev/shm/scratch \
  --index-filter "git rm --cached -f --ignore-unmatch '89_Tic-Tac-Toe/python/TicTacToe_exe/assets/tie.png'" \
  --tag-name-filter cat -- --all

History Rewrite Option 2: Automatic

Delete all files from the history that are no longer there. I'm uncertain what happens with files that were moved!

# Install git-filter repo; several options: https://github.com/newren/git-filter-repo/blob/main/INSTALL.md
pip install git-filter-repo

# Run it
git filter-repo --analyze

# Create a list of all files that should get deleted
tail +3 .git/filter-repo/analysis/path-deleted-sizes.txt \
    | tr -s ' ' \
    | cut -d ' ' -f 5- \
    > .git/filter-repo/analysis/path-deleted.txt

# Before you do this, you can check if there are things you want to keep
git filter-repo --invert-paths --paths-from-file .git/filter-repo/analysis/path-deleted.txt --force

rm -rf .git/filter-repo

Alternatively, you could use this path-deleted.txt. I've removed all lines that match

(\.pl|\.py|\.cs|\.java|\.md|\.bas|\.rb|\.gitignore|\.rs|\.js|\.vb|\.sln|\.txt|\.html|\.csproj|\.vbproj|\.kt)$

from basic-computer-games.

MartinThoma avatar MartinThoma commented on July 21, 2024

The effect of this:

$ ls -lh
  74M  backup.bundle
 3,4M  repo-after-history-rewrite-and-clean-manual-deletion.bundle
 3,1M  repo-after-history-rewrite-and-clean-automatic-deletion.bundle

When you now execute this snippet you can see:

2e07bb068f29   41KiB 01_Acey_Ducey/rust/target/debug/incremental/rust-8frg64vi8djd/s-g737sgtzl9-gc3nmb-ydny6jjnqtbz/dep-graph.bin
6557ca9f5546   42KiB 00_Alternate_Languages/88_3-D_Tic-Tac-Toe/csharp/Qubic.cs
595db6616bd6   43KiB 88_3-D_Tic-Tac-Toe/csharp/Qubic.cs
a01944e199e2   43KiB 88_3-D_Tic-Tac-Toe/csharp/Qubic.cs
513651d6a5e4   44KiB 88_3-D_Tic-Tac-Toe/csharp/Qubic.cs
9a4573c62152   48KiB 84_Super_Star_Trek/javascript/superstartrek.mjs
b8ecb9343b12   49KiB 84_Super_Star_Trek/java/SuperStarTrekGame.java
213b2a0b8d38   49KiB 84_Super_Star_Trek/java/SuperStarTrekGame.java
7454180f2ae8   58KiB buildJvm/gradle/wrapper/gradle-wrapper.jar
ea71f1cf7903   58KiB 00_Alternate_Languages/01_Acey_Ducey/elm/package-lock.json
6fe43fa79007  115KiB 75_Roulette/perl/roulette-test.t
d2946a198344  125KiB 00_Alternate_Languages/01_Acey_Ducey/elm/docs/app.js
ccf0500fd14b  196KiB buildJvm/build_53_King_kotlin/build/install/build_53_King_kotlin/lib/kotlin-stdlib-common-1.6.0.jar

In case we don't need the buildJvm folder, we could reduce the allowed file size from 1MB to 200 KB.

from basic-computer-games.

coding-horror avatar coding-horror commented on July 21, 2024

I think we have definitely decided we don't want any build or IDE specific files in the repo, so proceed accordingly there...

from basic-computer-games.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.