6

I'm thinking on writing some tutorial on de-sloppifying some open-source projects, with I'm likely ending up at least starting some of them.

you are viewing a single comment's thread
view the rest of the comments
[-] bignose@programming.dev 6 points 2 days ago* (last edited 1 day ago)

It may depend where the project is and what you want to bring with you.

If you're asking solely about the Git repository: you need to find exactly which commit is the latest one you want to bring, and specify that commit identifier (the hash of that commit) as the “starting point” when you create a new branch.

git branch […] []

https://git-scm.com/docs/git-branch

So, clone the repository locally however you need to do that. Then, in your local repository, modify what the branches point to:

e.g. If you determined the latest commit you want to bring, has commit identifier “deadbeefbad1dea”, you can create the branch named “before-the-slop”:

git branch before-the-slop deadbeefbad1dea

Now the new branch “before-the-slop” has all the commits up to that, and no further. That's what you'll base your fork on.

git branch before-the-slop

git rev-parse HEAD # → deadbeefbad1dea

Then rename the old “main” or whatever branch, to something like “sloppified-project-main” that gets it out of the way; rename your “before-the-slop” branch to “main”; and set “main” as the default branch in your repository.

git branch --move main sloppified-project-main

git branch --move before-the-slop main

git config set --local init.defaultBranch main

Some time later, when you've confirmed your repository is how you like it, delete the “sloppified-project-main” branch:

git branch --delete sloppified-project-main

and breathe easy.

this post was submitted on 15 Oct 2026
6 points (68.8% liked)

Git

4800 readers
37 users here now

Git is a free and open source distributed version control system designed to handle everything from small to very large projects with speed and efficiency.

Resources

Rules

  1. Follow programming.dev rules
  2. Be excellent to each other, no hostility towards users for any reason
  3. No spam of tools/companies/advertisements. It’s OK to post your own stuff part of the time, but the primary use of the community should not be self-promotion.

Git Logo by Jason Long is licensed under the Creative Commons Attribution 3.0 Unported License.

founded 3 years ago
MODERATORS