Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Track existing folder from remote git repo

Tags:

git

github

Somehow the .git folder got deleted from my project folder. My project folder may contain changes which I don't know of. Maybe it can be older than the remote version on GitHub.

Is there a way I can start tracking everything again so that I can run git status to see the changes?

like image 715
Elmo Avatar asked Nov 01 '25 09:11

Elmo


1 Answers

You can create the .git folder in your project folder by :

$ git init

Then you can add and commit all the files you wish :

$ git add .
$ git commit -m 'some comment'

Then you add the remote repository (the exact command depends on your project name in GitHub and your credentials to access it) :

$ git remote add origin git@gitserver:/opt/git/project.git

Now you can do git fetch to get all the branches from the remote version, and decide what to do with them.

like image 172
Eran Avatar answered Nov 03 '25 00:11

Eran