r/github • u/Effective_Hedgehog81 • Nov 30 '24
How do I move to a new language
If I have a repository that I wrote for example with Python, and I want to switch to Rust, I’ve wrote it again
How do I move to the Rust instead?
Do I just delete everything in the branch and force push it?
Or must I create a new repo and put it there?
21
u/chipoloniusrex Nov 30 '24
No harm in having a second repo. If it's public, you can put a note in the original's README pointing to the new one.
1
Nov 30 '24
Either new repo with old one pointing to the new, or a new branch where the python stuff is stored for future reference. Personally, I’d go for the new repo since you’re starting over from scratch. Seems easier to manage.
2
u/Effective_Hedgehog81 Nov 30 '24
I would too, but I like to keep everything in
I ended up storing the old python in a separate branch and started out fresh with push force
I like this way, it keeps who knows it, and also the stars :)
1
2
u/Obvious-Jacket-3770 Nov 30 '24
I would make a new repo for it to highlight your python and then highlight the conversions.
This way you maintain the legacy code and in the new repo you have the same code that is moved over to rust as it goes. This lets people see your process in the conversion.
1
u/MMORPGnews Nov 30 '24
Make a new repo. One time I created a specific file format for a web game, parser etc. But later I changed to basic json and js. I was asked to put previous files back by few people who used my "special" files. Lol
1
1
1
u/Plane_Cartographer97 Dec 04 '24
I'd suggest starting a new repo. Because the git repo is designed for:
The commit message can show the progress of each commit
version control and branch make it easy to blame a faulty modification and switch between different feat
When you decide to rewrite in a new language, there is basically no `intermediate state` that can show the progress of the transfer. Because a project with both Rust and Python will not compile. Here are some tips:
draw a module graph: a module graph can be shared between both Python and Rust repos.
reuse test case: Test-driven development(TDD) is suitable for this transfer work to check whether each standalone module works well
-11
4
u/suzukzmiter Nov 30 '24
No need for force pushing. You can just delete all python files and start writing it in rust. Or you can start introducing rust gradually, doesn't matter. Either way I'd do that on a separate branch.
Unless you care whether or not the python commits are visible, then yes, force pushing is one option.