简体   繁体   中英

Add existing project to existing git repository

I've got a Visual Studio solution already part of a git repository on TFS. The solution consists of a number of projects. Everything was fine until recently I renamed one of the projects. I've noticed that the renamed project has dropped out of the repository and I can't figure out how to get it back in.

Googling reveals a lot of information about adding existing solutions to new git repositories, but I can't find any advice on how to fix the situation I find myself in. I'm a git noob which certainly isn't helping; I can't even figure out got to call git from the command line.

Surely there's a simple sequence of git commands to get my project back in the repository?

Having git integration with both TFS and your Visual Studio IDE sounds nice, but when it comes to trouble-shooting git, sometimes it's best to go directly to git's native command line interface.

Try to cd into your solution/project working directory, and check if there's a .git folder in there. That represents the git repo for your solution/project. Once you've confirmed that the folder exists, run

git status

to check the current status of your working copy. If you have untracked files or unstaged changes, you may wish to add them now with

git add <filepaths>

Make sure that you don't forget to add any related changes to your Visual Studio solution and project files, otherwise Visual Studio may not recognize the changes that you've made.

Once you've staged your files, go ahead and run

git commit
# or
git commit -m "message"

to commit your changes. Then verify that Visual Studio recognizes the changes that you've made to your solution/project.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM