▲ 767 ▼ Git, invented in 2005. Programmers on 2004: (lemmy.eco.br) submitted 2 years ago by driving_crooner@lemmy.eco.br to c/programmer_humor@programming.dev 157 comments fedilink hide all child comments
[–] dev_null@lemmy.ml 10 points 2 years ago (8 children) You don't if you just clone the repo you created. permalink fedilink source parent hideshow 8 child comments replies: [–] 30p87@feddit.org 1 point 2 years ago (7 children) Huh? I'm talking about existing code being in a dir, then initting a git repo there, creating a pendant on your hoster of choice and then pushing it there. Wouldn't cloning the repo from step 3 to the code from step 1 overwrite the contents there? permalink fedilink source parent hideshow 7 child comments replies: [–] stembolts@programming.dev 8 points 2 years ago* (last edited 2 years ago) (4 children) There are multiple solutions to this without using --force. Move the files, clone, unmove the files, commit, push being the most straightforward that I can summon at this time.. but I've solved this dozens of times and have never use --force. permalink fedilink source parent hideshow 4 child comments replies: [–] Hoimo@ani.social 3 points 2 years ago (3 children) If your remote is completely empty and has no commits, you can just push normally. If it has an auto-generated "initial commit" (pretty sure Github does something like that), you could force push, or merge your local branch into the remote branch and push normally. I think cloning the repo and copying the contents of your local repo into it is the worst option: you'll lose all local commits. permalink fedilink source parent hideshow 3 child comments replies: [–] Jayjader@jlai.lu 2 points 2 years ago If it's a single, generated, "initial" commit that I actually want to keep (say, for ex I used the forge to generate a license file) then I would often rebase on top of it. Quick and doesn't get rid of anything. permalink fedilink source parent [–] stembolts@programming.dev 2 points 2 years ago* True, in the situation with a local history maybe it's worthwhile to --force to nuke an empty remote. In that case it is practical to do so. I just typically like to find non-force options. permalink fedilink source parent [–] firelizzard@programming.dev 1 point 2 years ago You can also just tell GitHub to not do that. permalink fedilink source parent [–] dev_null@lemmy.ml 3 points 2 years ago Yeah, I was thinking of a new repo with no existing code. In your case you'd want to uncheck the creation of a readme so the hosted repo is empty and can be pushed to without having to overwrite (force) anything. permalink fedilink source parent [+] Hoimo@ani.social 1 point 2 years ago [deleted] permalink fedilink source parent
[–] 30p87@feddit.org 1 point 2 years ago (7 children) Huh? I'm talking about existing code being in a dir, then initting a git repo there, creating a pendant on your hoster of choice and then pushing it there. Wouldn't cloning the repo from step 3 to the code from step 1 overwrite the contents there? permalink fedilink source parent hideshow 7 child comments replies: [–] stembolts@programming.dev 8 points 2 years ago* (last edited 2 years ago) (4 children) There are multiple solutions to this without using --force. Move the files, clone, unmove the files, commit, push being the most straightforward that I can summon at this time.. but I've solved this dozens of times and have never use --force. permalink fedilink source parent hideshow 4 child comments replies: [–] Hoimo@ani.social 3 points 2 years ago (3 children) If your remote is completely empty and has no commits, you can just push normally. If it has an auto-generated "initial commit" (pretty sure Github does something like that), you could force push, or merge your local branch into the remote branch and push normally. I think cloning the repo and copying the contents of your local repo into it is the worst option: you'll lose all local commits. permalink fedilink source parent hideshow 3 child comments replies: [–] Jayjader@jlai.lu 2 points 2 years ago If it's a single, generated, "initial" commit that I actually want to keep (say, for ex I used the forge to generate a license file) then I would often rebase on top of it. Quick and doesn't get rid of anything. permalink fedilink source parent [–] stembolts@programming.dev 2 points 2 years ago* True, in the situation with a local history maybe it's worthwhile to --force to nuke an empty remote. In that case it is practical to do so. I just typically like to find non-force options. permalink fedilink source parent [–] firelizzard@programming.dev 1 point 2 years ago You can also just tell GitHub to not do that. permalink fedilink source parent [–] dev_null@lemmy.ml 3 points 2 years ago Yeah, I was thinking of a new repo with no existing code. In your case you'd want to uncheck the creation of a readme so the hosted repo is empty and can be pushed to without having to overwrite (force) anything. permalink fedilink source parent [+] Hoimo@ani.social 1 point 2 years ago [deleted] permalink fedilink source parent
[–] stembolts@programming.dev 8 points 2 years ago* (last edited 2 years ago) (4 children) There are multiple solutions to this without using --force. Move the files, clone, unmove the files, commit, push being the most straightforward that I can summon at this time.. but I've solved this dozens of times and have never use --force. permalink fedilink source parent hideshow 4 child comments replies: [–] Hoimo@ani.social 3 points 2 years ago (3 children) If your remote is completely empty and has no commits, you can just push normally. If it has an auto-generated "initial commit" (pretty sure Github does something like that), you could force push, or merge your local branch into the remote branch and push normally. I think cloning the repo and copying the contents of your local repo into it is the worst option: you'll lose all local commits. permalink fedilink source parent hideshow 3 child comments replies: [–] Jayjader@jlai.lu 2 points 2 years ago If it's a single, generated, "initial" commit that I actually want to keep (say, for ex I used the forge to generate a license file) then I would often rebase on top of it. Quick and doesn't get rid of anything. permalink fedilink source parent [–] stembolts@programming.dev 2 points 2 years ago* True, in the situation with a local history maybe it's worthwhile to --force to nuke an empty remote. In that case it is practical to do so. I just typically like to find non-force options. permalink fedilink source parent [–] firelizzard@programming.dev 1 point 2 years ago You can also just tell GitHub to not do that. permalink fedilink source parent
[–] Hoimo@ani.social 3 points 2 years ago (3 children) If your remote is completely empty and has no commits, you can just push normally. If it has an auto-generated "initial commit" (pretty sure Github does something like that), you could force push, or merge your local branch into the remote branch and push normally. I think cloning the repo and copying the contents of your local repo into it is the worst option: you'll lose all local commits. permalink fedilink source parent hideshow 3 child comments replies: [–] Jayjader@jlai.lu 2 points 2 years ago If it's a single, generated, "initial" commit that I actually want to keep (say, for ex I used the forge to generate a license file) then I would often rebase on top of it. Quick and doesn't get rid of anything. permalink fedilink source parent [–] stembolts@programming.dev 2 points 2 years ago* True, in the situation with a local history maybe it's worthwhile to --force to nuke an empty remote. In that case it is practical to do so. I just typically like to find non-force options. permalink fedilink source parent [–] firelizzard@programming.dev 1 point 2 years ago You can also just tell GitHub to not do that. permalink fedilink source parent
[–] Jayjader@jlai.lu 2 points 2 years ago If it's a single, generated, "initial" commit that I actually want to keep (say, for ex I used the forge to generate a license file) then I would often rebase on top of it. Quick and doesn't get rid of anything. permalink fedilink source parent
[–] stembolts@programming.dev 2 points 2 years ago* True, in the situation with a local history maybe it's worthwhile to --force to nuke an empty remote. In that case it is practical to do so. I just typically like to find non-force options. permalink fedilink source parent
[–] firelizzard@programming.dev 1 point 2 years ago You can also just tell GitHub to not do that. permalink fedilink source parent
[–] dev_null@lemmy.ml 3 points 2 years ago Yeah, I was thinking of a new repo with no existing code. In your case you'd want to uncheck the creation of a readme so the hosted repo is empty and can be pushed to without having to overwrite (force) anything. permalink fedilink source parent