When I add a solution to source control in VS 2019 Azure Devops only the startup project gets added - how do I add the others? - azure-devops

I am working on a solution that has 14 projects (so far) in it. I added the solution to Azure Devops source control and can see that the solution and the startup project have the little locks in the solution explorer, also I can see the startup project files in the devops repo, but I can't see how to add the other projects. Obviously I messed up somewhere, since ideally the repo would contain a folder for the startup project rather than the files themselves, but I don't know how to "undo" the source control and reset my solution back to its original state.
Can someone tell me how to either fix the source control so that the master branch contains all of the projects in sub-folders (as per the visual studio folder structure) - i.e. how to move the startup project files in the devops repo to a sub-folder and how to add the other projects to their own sub-folders, or, failing that, how to undo the source control so that all of my solution files are back on my local hard disk?
Any advice will be appreciated.

You mentioned that you are using git. So when you DO NOT have local changes which are not pushed to your git server, that means everything is "synced".
Make a backup of your folder, just copy & paste everything!
You can just delete the .git folder. So you have no "link" to the git server anymore.
You can the link the "folder" again to your git server, with sth. like:
git remote add origin https://YOURNAME.visualstudio.com/YOURPROJECT.git
Other option is check your .gitignore file, maybe some of your projects are excluded.
When you are working with Visual Studio, can can also create a new empty solution and add the projects one by one. Also be sure that there is NO Filter in Project Explorer in Visual Studio.
You can also check your git changes, with git log or git status from any terminal or command line tool.

Related

Pushing Xamarin forms to Github

I'm trying to push my xamarin forms project to github .
I've tried the regular method following the github instruction & using command line but xamarin forms project usually are big in size so that it won't be pushed throw the CMD and it recommends the Git LFS instead.
however, I found that we can push the project to github
https://devlinduldulao.pro/how-to-use-git-and-github-in-xamarin-development/
using the GitHub Extension for Visual Studio and I have installed it but the second step is to add the solution to source control.
but I cannot find the latter option in my menu
so can anyone help me with this problem, all I need to do is to push my project to github if there any other option than the one I have provided in the article above please mention it.
thanks in advance.
If its trying to push a lot, then you are missing a .gitignore file. Put this in the root folder of your solution.
Here is a github list of useful gitignore files.
A good one to use for this purpose is VisualStudio.gitignore.
At minimum, have these lines in your .gitignore file:
[Bb]in/
[Oo]bj/
.vs/
bin and obj are the main folders containing results of building. These are re-creatable from source files, so should not be in repo.
.vs is where visual studio keeps all its user-specific files (such as .suo).
This question seems to be more a git problem than a Xamarin problem. Xamarin.Forms projects aren't bigger than other projects - but you have to ensure you excluded all the build output from the beginning (using a .gitignore-file for .NET projects) - otherwise you commit binaries and your nuget-feed.
Seeing this menu structure, it seems, you already are working with git (at least with a local repo without remote). So you should check your git repo settings and add github as remote: https://learn.microsoft.com/en-us/visualstudio/version-control/git-settings?view=vs-2022

What Egit actions do I take to get copy of src file TESTGIT1 from MainServerRepository into LocalServerRepo to work on?

As a new Egit user, aiming to set up version control to update the way a team manages source code without changing locations of our build and dev servers and to identify correct Egit commands to use for check in and check out code from both servers.
In a single Eclipse workspace, initially had one project without use of Egit just a basic automatic and adhoc file copy back up of changed development directory into folders with dates of backup. Promotion to the build server was done by manually copying source files and binaries, doing a diff between source on the MainServer and local server to manage any merges. Now need to implement a proper version control system, using Egit, so as a first time Egit user. I have set up two test Eclipse projects in my workspace: project A shared with MainServerRepository and project B shared with LocalServerRepo. The two git repositories will be in different directories: MainServerRepository on the network and LocalServerRepo on my area on the network where I backup my PC.
What Egit actions do I take to promote latest TESTGIT1.src from MainServerRepository into LocalServerRepo to work on in my local server? (Team > Fetch from upstream is grayed out). Then, once tested, how do I check in src for TESTGIT1 into the main build server project, source and objects are in MainServerRepository?
I've used Team > Commit successfully to check in, but am using cut and paste to move code between two projects (prior to commit) and feel there must be a better way to do this or to set up the projects differently within Eclipse.
Or should I be using Team > push or Team > merge?
Do I need local repository or should I just check out into workspace?
Any comments/ question/assistance would be welcome as haven't figured it out from reading the EGit/User_Guide.
Edit TESTGIT1.src in Eclipse project shared with LocalServerRepo(testGitRepo) until work on it is complete on local server. Then, apply same changes to TESTGIT1 in the main build server project, using right click copy +paste from right click, team > check in. Then in Git Staging view, click plus sign to add to index (staging area), then click commit button, merging in with any other changes made to TESTGIT1.src by other developers. Don't use push command to push entire contents of LocalServerRepo. Or is there a better answer?

Eclipse TFS branch show also changes in root

I'm using Eclipse importing TFS projects, one project is:
$/product mapped to C:\dev\product
I opened a branch and started working on different workspace:
$/product-branch mapped to C:\dev-branch\product
I worked on each project successfully
But now in branch in TFVC Pending Changes I see changes I made (checkouts) also in C:\dev\product ($/product)
Why am I seeing such changes and How can I separate those branches when I switch to different workspace?
EDIT
My TFS 2010 is using server workspace.
A TFVC workspace is the container for all of the work that should be grouped together (think of it like the contents of a Git repository). Now if you open a sub-folder of a Git repository in Eclipse and you've made changes at a folder that's higher up (that is, one you didn't explicitly open), the Git SCM still shows those files. It doesn't only show the files modified for the folder that you've got open. That's the same behavior as what the TFVC support is currently showing.
If you are using server workspace and checked out work under a different workspace, it will also show pending changes in pending changes list. Take a look at this similar issue: https://stackoverflow.com/a/423439/5391065
As a workaround, you could temporarily exclude no need changes in another branch to exclude list.

Publishing to github results in an empty repository

I am new to git. I downloaded the desktop version (for Windows). I dragged the folder containing my project into the big window, "Get started by adding a repository." All the files showed up in the left window. Then I clicked on "Publish Repository". It then shows 143 files have changed, with 0 unsynced.
But when I go to my account on the git website, the repository is empty. The only files in it are .gitattributes and .gitignore. The whole idea here is that I want to share this project with other people.
Help out a git newbie and explain how I get the entire solution into git?
Thanks!
As you already have the remote repository at GitHub, you should use the clone option first to clone your repository locally.
This will create a folder (your repository clone) on the default location containing those two files.
Then you can copy your project files to this folder and try to sync again.

Eclipse Projects And Git

I used computer A via the Terminal to create a) create a git repository, b) add an index.html file to the repo, c) add a remote origin, d) push to the remote origin. All OK.
Then, i used computer B to clone that repository via Terminal. Then, I opened Eclipse (equipped with Egit), and created a new project in the folder that was created by the cloning process. Then I used Eclipse to push any changes to the remote origin.
Returning to computer A, I used Eclipse to create a project in the original repo folder, and then I attempted to pull from the remote origin, in order to get the changes that were pushed when using computer B.
Eclipse will not do it. It complains the I have items such as .settings, .project and similar and since they are not under version control it won't overwrite them by fetching files from the server. I had to manually delete those files (via Terminal) and then Eclipse worked as expected.
Please provide information on how to avoid this.
Should I create the local repo from within Eclipse and then push it to the remote origin, so that items such as (.settings) are under version control and (if so) how would that cause trouble to people cloning the repo and use different versions of Eclipse?
Should I gitignore those items?
Should I ask Eclipse to save its own affiliated files to another folder (not that i am aware how to do that, i only know that NetBeans does it)?
Looks like you didn't gitignored eclipse files.
Probably, when you commit/push via egit, you also commit and push those files you already had unversioned in your machine A, so git complains, because you are asking to override existing unversioned files.
I strongly recommend you to gitignore those eclipse files. You can see examples of .gitignore files in the github gitignore repo.
Hope it helps.
It complains because if you pull the changes from your remote it will overwrite your local files. That is the problem. The other answerer has right. You should better add all the eclipse project files and and target .settings and classpath to gitignore. You can use a global gitignore for your computers as well, before creating projects. You could use maven for example, then you can import your projects only from the pom.xml-s given in the git repository.
I use them the same. Egit and other guis are a bit too complex to work with. Git repositories can get easy in an inconsistent state where you should use the oldfashioned terminal to solve things. Like, rebasing, merging on conflicts. Gits learning curve is solid.
Now you can solve your problem if on the first computer save a backup of your original and clones your project later, after fixed it on the second. On the second git remove all this files, but use the --cached option to avoid deleting them. Before you do it so, check the help of git remove! after you have done this, put them into the .gitignore as filenames with wildcards. You can also use a global gitignore file in your user folder. Creating a .gitconfig file where you can specifiy the global ignore with the following :
[core]
excludesfile = ~/.gitignore_global
Than just create the .gitignore_global like this :
/nbproject
/bin
/build.xml
.idea
chess.iml
target/
bin
( This file is for idea and netbeans. you can add eclipse project files here )
You can have .gitignore files per project too. You can commit them to the repository, so on the next machine you do not have to do this again. The nicest way I think is having a dotfiles git repository, which is a git repo of your home directory and the dotfiles in it. I also use it for different windows and linux distros.
That's all. You should keep all of your configuration in a safe place. And source code management can do it. But do not commit private stuff to public a place! ;)
Oh I wanted to mention that, you can also have a .gitignore entry in your .gitignore file. That can be very useful when you do not want to touch a repository but need to add a gitignore to hide some stuff especially from the given repo.