mirror of
https://codeberg.org/small-hack/open-slopware.git
synced 2026-08-30 09:54:03 +02:00
[How to create a slop free fork] Instructions using got (#1105)
Proposal to fix #921 Co-authored-by: Antoine Le Gonidec <vv221@vv221.fr> Reviewed-on: https://codeberg.org/ethical-foss/open-slopware/pulls/1105 Reviewed-by: Ethical FOSS admin <ethical-foss-admin@noreply.codeberg.org>
This commit is contained in:
parent
046a4aef39
commit
b7c7fa146d
1 changed files with 123 additions and 62 deletions
|
|
@ -28,81 +28,139 @@ Let's take tldr-pages as an example, as that was something the community recentl
|
|||
> [!tip]
|
||||
> In the above case, the tldr repo was linked in the first column of the table, but in cases where it's not you can just click the lasted untainted version link and chop off everything after the name of the project, so https://github.com/tldr-pages/tldr/releases/tag/v2.3 becomes https://github.com/tldr-pages/tldr
|
||||
|
||||
4. Open up a terminal and find a directory where you'd like to keep this project. Then clone the repo there. Here is an example where we keep things in the projects directory within your home directory:
|
||||
4. Open up a terminal and find a directory where you'd like to keep this project. Then clone the repo there. Here are examples where we keep things in the projects directory within your home directory:
|
||||
|
||||
```bash
|
||||
# creates a directory called projects in your ~, which is your home directory
|
||||
mkdir -p ~/Projects
|
||||
- With git (well-known tool, polluted by generative AI)
|
||||
|
||||
# change your current directory into the new projects directory
|
||||
cd ~/Projects
|
||||
```bash
|
||||
# creates a directory called projects in your ~, which is your home directory
|
||||
mkdir -p ~/Projects
|
||||
|
||||
# clones the repo in your projects directory
|
||||
git clone https://github.com/tldr-pages/tldr.git
|
||||
# change your current directory into the new projects directory
|
||||
cd ~/Projects
|
||||
|
||||
# changes directory to your recently cloned project (in this example, it's the tldr repo)
|
||||
cd tldr
|
||||
```
|
||||
# clones the repo in your projects directory
|
||||
git clone https://github.com/tldr-pages/tldr.git
|
||||
|
||||
# changes directory to your recently cloned project (in this example, it's the tldr repo)
|
||||
cd tldr
|
||||
```
|
||||
|
||||
- With [got] (lesser-known tool, compatible with git, clean from generative AI)
|
||||
|
||||
```bash
|
||||
# creates a directory called projects in your ~, which is your home directory
|
||||
mkdir -p ~/Projects
|
||||
|
||||
# change your current directory into the new projects directory
|
||||
cd ~/Projects
|
||||
|
||||
# clones the repo in your projects directory
|
||||
got clone -a https://github.com/tldr-pages/tldr.git
|
||||
got checkout tldr.git
|
||||
|
||||
# changes directory to your recently cloned project (in this example, it's the tldr repo)
|
||||
cd tldr
|
||||
```
|
||||
|
||||
5. Grab the new location of your new repo :) If you're using codeberg, you want to grab the SSH url for cloning, which you can find just below the repo stats. We've highlighted it and also we show you the button you can click to copy it easily here:
|
||||
|
||||
<img src="./img/how_to/copy_new_repo_url_codeberg.png" alt="Screenshot of the top of the page for https://codeberg.org/ethical-foss/ethical-foss where we've highlighted the clone url and drawn orange arrows pointing to the word SSH, the URL, and the copy button. They exist just below the repo states, but before the repo's code search bar and repo files">
|
||||
|
||||
6. Change the upstream origin of your repo to be your new fork's SSH URL. There are two ways to do this. The first way is to use the `git` command:
|
||||
6. Change the upstream origin of your repo to be your new fork's SSH URL.
|
||||
|
||||
```bash
|
||||
git remote set-url origin ssh://git@codeberg.org/ethical-foss/ethical-foss.git
|
||||
```
|
||||
- With git
|
||||
|
||||
Another way is to edit the `.git/config` file Use your editor of choice to open the following file:
|
||||
There are two ways to do this. The first way is to use the `git` command:
|
||||
|
||||
```bash
|
||||
# We're using evi here, but you can use any editor you're comfortable with.
|
||||
# If you're new, nano is always a safe bet as it has tips at the bottom of the screen.
|
||||
evi .git/config
|
||||
```
|
||||
```bash
|
||||
git remote set-url origin ssh://git@codeberg.org/ethical-foss/ethical-foss.git
|
||||
```
|
||||
|
||||
The file will look like this:
|
||||
Another way is to edit the `.git/config` file Use your editor of choice to open the following file:
|
||||
|
||||
```config
|
||||
[core]
|
||||
repositoryformatversion = 0
|
||||
filemode = true
|
||||
bare = false
|
||||
logallrefupdates = true
|
||||
[remote "origin"]
|
||||
url = https://github.com/tldr-pages/tldr.git
|
||||
fetch = +refs/heads/*:refs/remotes/origin/*
|
||||
[branch "main"]
|
||||
remote = origin
|
||||
merge = refs/heads/main
|
||||
```
|
||||
```bash
|
||||
# We're using evi here, but you can use any editor you're comfortable with.
|
||||
# If you're new, nano is always a safe bet as it has tips at the bottom of the screen.
|
||||
evi .git/config
|
||||
```
|
||||
|
||||
You want to change your the value of "url" to your new SSH URL. In this case, it would look like this, since the new repo is ethical-foss:
|
||||
The file will look like this:
|
||||
|
||||
```config
|
||||
[core]
|
||||
repositoryformatversion = 0
|
||||
filemode = true
|
||||
bare = false
|
||||
logallrefupdates = true
|
||||
[remote "origin"]
|
||||
url = ssh://git@codeberg.org/ethical-foss/ethical-foss.git
|
||||
fetch = +refs/heads/*:refs/remotes/origin/*
|
||||
[branch "main"]
|
||||
remote = origin
|
||||
merge = refs/heads/main
|
||||
```
|
||||
```config
|
||||
[core]
|
||||
repositoryformatversion = 0
|
||||
filemode = true
|
||||
bare = false
|
||||
logallrefupdates = true
|
||||
[remote "origin"]
|
||||
url = https://github.com/tldr-pages/tldr.git
|
||||
fetch = +refs/heads/*:refs/remotes/origin/*
|
||||
[branch "main"]
|
||||
remote = origin
|
||||
merge = refs/heads/main
|
||||
```
|
||||
|
||||
You want to change your the value of "url" to your new SSH URL. In this case, it would look like this, since the new repo is ethical-foss:
|
||||
|
||||
```config
|
||||
[core]
|
||||
repositoryformatversion = 0
|
||||
filemode = true
|
||||
bare = false
|
||||
logallrefupdates = true
|
||||
[remote "origin"]
|
||||
url = ssh://git@codeberg.org/ethical-foss/ethical-foss.git
|
||||
fetch = +refs/heads/*:refs/remotes/origin/*
|
||||
[branch "main"]
|
||||
remote = origin
|
||||
merge = refs/heads/main
|
||||
```
|
||||
|
||||
- With got
|
||||
|
||||
Upstream origin is set in the "tldr.git" directory (the repository), not the "tldr" one (the workspace).
|
||||
You need to edit the file "got.conf", that should look like this at first:
|
||||
```config
|
||||
remote "origin" {
|
||||
server github.com
|
||||
protocol https
|
||||
repository "/tldr-pages/tldr.git"
|
||||
fetch_all_branches yes
|
||||
}
|
||||
```
|
||||
And like this to use the fork SSH URL instead:
|
||||
```config
|
||||
remote "origin" {
|
||||
server git@codeberg.org
|
||||
protocol ssh
|
||||
repository "/ethical-foss/ethical-foss.git"
|
||||
fetch_all_branches yes
|
||||
}
|
||||
```
|
||||
|
||||
7. Here comes the part where you check out the last known untainted commit or version. In this case, the last version of `v2.3`. You can do a hard reset of your fork to that exact version. This drops all the commits after that. To do that, run the following:
|
||||
|
||||
```bash
|
||||
# hard reset your branch to the old commit or version
|
||||
git reset --hard v2.3
|
||||
- With git
|
||||
|
||||
# force push up your now untainted repo
|
||||
git push --force
|
||||
```
|
||||
```bash
|
||||
# hard reset your branch to the old commit or version
|
||||
git reset --hard v2.3
|
||||
|
||||
# force push up your now untainted repo
|
||||
git push --force
|
||||
```
|
||||
|
||||
- With got
|
||||
|
||||
```bash
|
||||
# hard reset your branch to the old commit or version
|
||||
got update -c v2.3
|
||||
got histedit -d
|
||||
|
||||
# force push up your now untainted repo
|
||||
got send -f
|
||||
```
|
||||
|
||||
8. The initial steps are now done and your new forked repo's history starts at the exact last known good version. Advanced git users can now cherry pick LLM commits out of the repo, but we recommend not doing that unless you're very confident with git. Instead, we think it's best that you create new commits to remove the AI and LLM generated code, because then this also keeps a cleaner history. In your "No AI Policy" or in your README, you can self disclose that the repo contains old commits from an LLM, but that you're working on replacing them or that you will not replace old commits, but all new commits will be done by humans. Either is fine. When it comes to AI Functionality, you'll also want to disclose that immediately and perhaps create an issue that says "Remove AI Functionality" to show users that you intend to remove that. You could also ask for help that that time.
|
||||
|
||||
|
|
@ -215,3 +273,6 @@ Codeberg also has great docs on [how to add new collaborators](https://docs.code
|
|||
|
||||
> [!warning]
|
||||
> Ensure you trust anyone you give access to your repo. Don't add people as collaborators whom you've never interacted with before!
|
||||
|
||||
<!-- multi-referenced links -->
|
||||
[got]: https://gameoftrees.org/
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue