Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Git: Download zip instead of clone, now cannot commit

Tags:

git

I accidentally manage to download a repo to a new machine by hitting the "download zip" instead of doing a clone.

I notice after I did a lot of changes, and now I have problems commit and push the new changes to github, since the git repo wasn't included in the zip.

What can I do?

Thanks

like image 936
BlackMouse Avatar asked Mar 14 '23 12:03

BlackMouse


2 Answers

You can clone the repo, but you don't have to "copy your files over the new repo"

git clone http://github.com/<user>/<repo>
cd <repo>

With the git --work-tree option, you can work in your git repo while considering another folder as your working tree:

git --work-tree=/path/to/unzipped/files add .
git status 
git commit -m "commit changes from unzipped folder"
like image 85
VonC Avatar answered Mar 16 '23 07:03

VonC


You can do a (shallow) clone into a separate directory and copy your changes over there.

like image 21
Sergej Koščejev Avatar answered Mar 16 '23 06:03

Sergej Koščejev