"re"-init a local repo


I know could achieve this by commit all + push again but i would like to learn more from git

I have this situation: a repote repo here on github without some files which weren t committed because i setted a gitignore file. Now i am on a new computer. I moved the folder (with the uncommitted files) in the new pc. How could i say to git to link my online repo with this folder?

I couldn t use clone because it will just download the remote repo, and also with init i wasn t lucky. Am I missing some option of init or do i need to do something else?

If you copied the entire repository directory from one computer to another computer, then your repository is probably still configured with the same remote.  If you are on the command-line you can run git fetch and if it doesn’t fail with an error, then you are still configured to talk to the remote repository on GitHub.

If your repository remote is properly configured, then you can go ahead and add the files you missed, commit them, and push them up to the remote.

1 Like

at the end yesterday i cloned and added the file i was missing, so i can’t try anymore what you suggested with fetch…

But when yesterday, before cloning, when i used git inside the folder it said me something like “not a git repository” strange!