简体   繁体   中英

Upload part of a project copied using git clone

Apologies, the answer to this is definitely online somewhere but I had trouble distilling key terms to google, I have a git project consisting of several projects I cloned (just git clone ssh) from another user. then edited and added my own packages to.

When I try to push them to my repository though, the cloned packages show up as links to the repo I cloned from. At least, it's the symbol that normally means it's a linked package; in this case you can't actually click on it. I want the copy with my changes to be uploaded, without having to submit a merge request or anything first.

Do I need to fork the original repos to fix this? Even though I have all the code downloaded locally, in the repo I'm trying to push from?

Edit: None of the submodules I'm trying to remove are listed in the.gitmodules, but I don't know if this is since before or after I tried removing them. I want to try adding them back in manually then doing another attempt at git submodule deinit, but will this remove all local edits I made to them?

Not sure if I got the question correctly, but I think the term yo are looking for is git remote .

git remote remove origin
git remote add origin yourRepo

These 2 commands will "unlink" project from its original repo and link to yours.

To remove a submodule from your tree, you can do so using git rm . To remove the submodule and add its files back as part of the outer repository needs some extra steps:

You should backup first (just do a cp -r of the outer repository if you want to be sure), to make sure you don't lose any unpushed changes!

# Move the submodule first - otherwise the directory will be deleted when you do git rm!
mv submoduleDir sobmoduleDirBak
git rm submoduleDir
mv submoduleDir2 submodileDir
# Before adding the directory back, we have to remove its .git
rm -rf submoduleDir/.git
git add submoduleDir

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM