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.
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
I'm new to using GitHub and Git , When I first created my console app I created a git repository and hit commit and push , it works fine for the console app which was present in the time of creating the git repository , but when I added a new class library(CalculatorLibrary) and started writing code in it , I realized the Changes are not detected in the git changes section and it doesn't exist in the GitHub copy of the repository either, Plz help me !
Project
Local Repository
I can see on your local repository folder pic that the Calculator Library is actually outside of your solution folder(ConsoleApp1 folder, which contains the calculator.cs project). To have them commited easily to the git all projects that are part of a solution should be under that solution folder. Hope it helps!
You created your Git repository inside the Calculator folder. Which means git keeps track of only the files and directories which are inside this folder.
If you want to track CalculatorLibrary you should have created a git repository one level higher. (which you could do by .git folder and creating a new repository in the folder that contains these two libraries)
I had the same problem, so I had to uncheck this box when creating the initial solution/project, then when I add another project to the solution for example a class library, it will be tracked in GIT:
I am able to add one separate file , make changes and the change is reflected in Team explorer in visual studio. I am able to push file to repos successfully. But When I try to add one folder , the files and subfolder present under the parent-directories are not reflected for changes in visual studio.
Kindly let me know if I should change any settings before making this commit
Step By Step Process
1. I am creating new repositary in azure artifacts
2. I am opening my visual studio --> Team explorer --> connect to server .
3. I have connected to my server and cloned it to my local . local repo is created
4 Now I copy my workspace and paste it in local repository. My workspace contains many folders and sub folders are present in the workspace.
5. In visual studio --> changes --> I am able to see only main folders or parent directory. (sub folders and files available in subfolders are not available in changes).
6. I committed and pushed the code.
7. Now in artifacts in repos , only main folder or parent directory is present, sub folders are not available.
According to your description for detail steps, there is nothing business with Azure Artifacts. Which used for Code once and share packages across your organization. Host your private Nuget, npm, and Maven packages with Azure Artifacts for more reliable, scalable builds.
Are you just talking about version control. There should be something wrong with your source control binding.
Do not directly copy and past files.
Suggest you to follow the official tutorial to add files in server.
I have created a C# project. I have created a Bitbucket account and want to put my project there.
What all should I put in the repository and what not to.
I am guess Debug and Release folders should not be uploaded. What about..
- Name/bin/Debug
- Name/obj/Debug
Thanks
It's a good idea to start with an established .gitignore file. GitHub has a project that maintains .gitignore files for various environments, including Visual Studio.
https://github.com/github/gitignore
Scroll down and grab VisualStudio.gitignore. Or you can download the file with this PowerShell command (set the current directory to the root of the repo, first):
(Invoke-WebRequest 'https://raw.githubusercontent.com/github/gitignore/master/VisualStudio.gitignore').Content > .gitignore
This should give you an idea of what the general consensus is on what belongs in source control and what doesn't in a Visual Studio solution. In particular, this will exclude the bin and obj folders so you don't commit outputs to the repository, as well as the .vs folder and *.user files, which are user-specific data. It also excludes files and folders used by popular third-party extensions that maintain their own user-specific data.
Once you have a good .gitignore file, you can use git add --all and it will add everything that's not ignored to the index.
Nothing in bin or obj should need to be committed. You'll also need csproj files and nuget package config files (be they xml or json). Things like appconfig files, and .vscode are up to you whether you want to have them in source control.
Sorry, a bit of a noobish question here...spent an hour on Google and in MSs help documents, my head appears to be in the wrong place, I can't figure this out.
I have a C# project set up in Visual Studio 2012 that has references to a few .dlls that I have on my own hard drive (NetOffice .dlls to be specific, for Excel Interop). I've been adding them by right clicking on my references folder, going to Add Reference and then going to Browse to find the files. At that point they are included and everything works as expected on my side.
The problem occurs when I share the project. I'm using Git to keep the project coordinated between myself and a couple team members. I'll run my commit and push it then have my teammate do his pull. Everything shows up on his computer correctly, but when we open up the project it tells me that the NetOffice .dlls are missing.
I'm guess that this is because the files are only linked locally on my computer, but I can't figure out, for the life of me, how to make the .dlls exist in the file structure so that they travel with the project when I push it.
We have a few NuGet packages we use as well, and they seem to work just fine after being transferred. I've also gone into the .dll properties for NetOffice and turned "Copy Local" to true, yet it's still not included.
All I want is to be able to link references and then send the whole thing (dlls included) to my teammate, what am I doing wrong? I figured I would want to simply include the .dlls in the project structure but... I'm just not understanding something. Any help please?
1 Create a folder in the file system at the same level as the solution file.
2 Copy the external dll's to that folder.
3 Add a Solution Folder tho the solution.
4 Add each dll to the the solution folder using add existing item
5 Reference the Dll's in the solution
The steps 3 and 4 aren't really necessary, but they help to keep things organized.
Lets assume your source control root folder is called SourceRoot
and your solution files are under a folder called JaySolutionFolder
I prefer:
Adding a new folder to your source control, under SourceRoot, called SharedDlls
Copy all external Dlls to this Folder.
Add this dll references form SharedDlls to your project.
Commit this folder
Now your teammates have to get JaySolutionFolder & SharedDlls to compile the sources.
Later this SharedDlls could be target directory of Build process (Using tools like TFS Bulid, NANT or else)
This will be a way to minimize team based development problems.
In release and software installation, you can use installers or software package builders like installshield or Visual Studio Setup Package or ... to solve external dlls problem
Hop this helps.
Although it's not good practise to include binaries in your git repository, doing so will solve your problem.
The quick fix could be to create lib directories in sensible locations within your repository (I'm not a C# developer but Gama Felix's suggestion seems correct).
Then commit these folders and push to the server.
I've created a Codeplex site for an app I'm building and right now I just right click the entire solution folder Visual C# Express created for me, and used that.
Now in my repo I have a lot files that I'm assuming will enable the user to compile my application on their end.
I heard I shouldn't upload the /obj folder and some other things.
What things are absolutely necesary for me to commit to my repository?
You should ignore the following, by setting the svn:ignore property on your project folder:
bin
obj
*.user
*.suo
You need the solution file, the C# project file(s), and all of the code files.
Basically, leave out the .suo file (with the solution), any user specific files (which will have your username appended to them, the bin\ and the obj\ folders. Everything else should be included.
It's common practice in organizations I've worked with to also include binary resources to which we don't have the source code and are required for the build in the source control. I'm aware that this is a somewhat controversial practice but it's worked wonders for us. Usually we keep them in a solution-rooted folder named 'Resources' or the like such that they're available for each developer to use when they check out the solution.
If you would use the Standard Edition of Visual Studio you could use the AnkhSVN Plug-In, but in Express this is not possible. :-(
So what you should exclude
folder obj
folder bin
file *.user
file *.ncb
Everything else has to be in your repository.