git - put files back under version control

61 views Asked by At

The situation I have now is this:

I took the project files from the server, unversioned, and copied them on the local machine. I did git init on it, added origin, pushed the files into the repo. Made a branch, made changes to this branch, committed, pushed them into the repo.

Now I want to put the files on the server under git and checkout the branch I made there. What do I have to do for this?

I can't really just delete and clone because there are untracked files on the server I'd like to keep.

1

There are 1 answers

0
hewo On BEST ANSWER

Create a backup directory on your Server.

git clone your repository in that backup directory.

Copy the files from Server directory to the backup directory.

Swap original server directory with the backup directory.