Home > Software design >  Resync local project to GitHub repository in Visual Studio
Resync local project to GitHub repository in Visual Studio

Time:10-17

I have an old project that uses GitHub as the git repository.

I've just made some changes to that project and now I need to update the repository.

But, after buying a new computer earlier this year, Visual Studio no longer knows about any connection to that repository.

So how can I fix this without losing any of the changes I just made? My two primary options given are Create Git Repository and Clone Repository. I don't think I want either of those.

CodePudding user response:

Apparently, the hidden .git folder is missing in the project, which identifies a folder on the disk as git repository. Without this folder, no git commands will be available (whether from the command line or any GUI tool).

I suggest the following steps to resync the project to github:

  • Check out the project from github to a new folder
  • Set the checkout folder to the branch where the project was when the .git folder was lost (since it's an old project, you can probably take master)
  • Copy the contents of the existing source folder into the checkout folder. Make sure not to copy any hidden .git folders if there are still broken leftovers.
  • Verify and commit the diff.
  • Related