I noted that some files in my solution explorer are not in source control as they do not have a padlock icon. I tried to rebind the solution as suggested here but I do not have a Source Control menu item under file.
It seems you are using Git as your source control. There is no Source Control menu item under File for Git. It’s a normal phenomenon. This menu item is only for TFVC.
No matter your folder(Solution items) are adding in source control or not, there is no padlock icon in front of it. It’s by designed. Normally, if you can see it in Solution Explorer, means it has been added in source control. You can double check it through your Web Portal(Code→Git→Your solution)
If you can’t see it , you want to add it in source control. Right click your solution in Solution Explorer, select source control, select commit, then commit and push. Or use git command, $ git add . /$ git commit -m "First commit"/ $ git push origin master
You can enable/disable the plugin selection from Tools->Options if you are using TFVC as your source control although I suspect Patrick is right with his assumption on Git.
I was indeed using Git but even right-clicking on my solution did not provide me with the source control option (as #Patrick suggested). Eventually I noted that in Team explorer > Changes there was a section containing Untracked Files. I clicked Add all, and these files started being tracked, thus solving my problem.
Related
Steps:
Navigate with a browser to the github.com/user_name/repo_name/commits page
To the right of the desired repo click the far right <> button
with the tooltip "Browse the repository at this point in the
history."
Note the page just navigated has a URL like
github.com/user_name/repo_name/tree/Some_UID
Click on the green "Code" button in the repo, then click "Open
in Visual Studio".
After launching the MS VS Web Protocol Handler Selector from the
popup dialog (with the "always allow Github to ..." checkbox), VS launches showing the Team Explorer dialog, with the URL of just
the base repo (github.com/user_name/repo_name) in the remote URL
box.
Attempt to replace the default URL with the desired commit
(github.com/user_name/repo_name/tree/Some_UID) in the box and then
click the Clone button.
The following message is generated at the top of the dialog:
Git failed with a fatal error.
repository 'https//github.com/user_name/repo_name/tree/Some_UID/' not found
An empty directory with the name Some_UID is also created in the base repository directory.
Is there another way, preferably from the VS/Github GUI, of opening an older commit in Visual Studio?
Edit: The obvious solution is to open the Git history window in VS and right click on an old commit in order to revert to it. Given that Git Revert creates a new commit, which adds to the Git history chain,- the idea here was, in fact, to somehow open a new solution (in a different directory) with the old commit for quick testing, and delete it when finished. An idea which might seem feasible so long as the new (temporary) solution had no Git, or at least no bindings to Git that would point to the original solution.
Clone the origin project.
Find the commit id, then reset to the id locally.
git reset --hard xxxxCommitIDxxxx
I'm working under a single repository and mostly in one solution.
However, during the work on the solution I do change other files as well, when I come to commit, however, AnkhSVN only shows the files that are part of the solution. That forces me to use TortoiseSVN to do the commit on the whole directory, which in turn misses some of the files that I added with AnkhSVN.
The simplest solution to this would be if AnkhSVN showed me ALL the pending changes for the repository. A worse alternative would be if AnkhSVN flagged added files so that TortoiseSVN would be also aware to them when doing commit from it.
Anyone knows a solution to these issues?
Thanks!
You can set an option to auto add files when new files are created that should be versioned by going to Tools -> Options -> Source Control -> Subversion Environment. Select "Directly add new files to Subversion" here.
Another alternative to make "New" files "Added" is the "Apply to Working Copy" command, available through the drop down next to the Commit button in the Pending Changes window.
In TortoiseSVN, there's a checkbox in the commit dialog "show unversioned items". If you check that box, the files that are not added yet are shown as well.
You can right click the svn folder then TortoiseSVN-->Add , will show all the items which is not included for supervision.
check the screen shot
I've (apparently) checked-in (added) a file that shouldn't have been added to a branch. I need to revert this, but since then, 20 or so changesets have been added to the repository.
I'm used to working with Subversion, where it's only a few clicks and it's out. How easy is it in TFS?
TFS is a pain to use in general (personal and biased opinion). Here's a how-to article from Microsoft on how to proceed to revert changes back (warning: more than a few clicks away).
As given in that article, the steps to revert to a prior version of (a) file(s) are:
In Source Control Explorer, right-click the file whose changeset you want to roll back, and then click Get specific version on the
context menu.
In the Get dialog box, select the prior version of the file, and then click Get. For more information, see How to: Retrieve
Old Versions of Files from
Changesets.
After this file is in your workspace, right-click the file, and then click Check Out for Edit on the context menu.
Right-click the file again, and then click Check In Pending Changes.
In the Check In - Source Files dialog box, select the file, and then click Check in.
The Resolve Conflicts dialog box appears.
Click Resolve to open the Resolve version conflict dialog box.
Select Discard server changes.
Click OK.
NOTE: To review your decision before discarding the server changes, you can click Compare to view the server and local copies
simultaneously.
In the Resolve Conflicts dialog box, click Close.
In Source Control Explorer, right-click the file, and then click Check In Pending Changes.
In the Check In - Source Files dialog box, click Check in.
As #Darin has posted, you can simply Get the state of the previous version/changeset onto your PC and then check it in as a new version, thus undoing the effect of the check in. This is dead easy and can be done from the GUI, but does involve a fair bit of faffing around.
If you're happy to use the command line, you can also command TFS to rollback the changeset for you. This does all the "work" of the above option, leaving you with a changeset in your pending changes that will undo the checkin's effect, but hopefully with a bit less effort.
If it is added by mistake, you don't want to roll back. Instead, you want to tf destroy (from the command line) that file in each of the branches.
TFS can be a bear to work with if you add a file, delete it, then re-add a new file with the same name. It makes merging much more difficult.
We've been using Source Safe for years. Now we use Tortoise SVN. It's quite a problem to not forget to add new files to the repository - Source Safe had integration with Visual Studio but I don't see any for Tortoise SVN and so I often forget to add files and this breaks the build.
Is there some industry-wide practice for simplifying adding new files? Maybe some Tortoise SVN command like "show me all unversioned files"?
In the Commit window, there's a checkbox in the lower left "Show unversioned files." Check it, and you'll see everything that hasn't been added to the repository. You'll want to use this in conjunction with either global ignores which are in Tortiose's settings, or with svn ignores (right click on the file, add to ignore list).
One really good (and free) VisualStudio integration for svn is ANKH Svn. If you add files or projects to a solution it automatically adds it to the svn and commits them like you are used to from Tortoise. There is a "pending changes" window which also shows added files which haven't been comitted yet.
Apart from Tortoise's option to "show unversioned files", I'd suggest having a continuous integration server checking your builds. At least for me, this ensures that if I do forget to add a source file, the server finds out before any of my colleagues get to roll their eyes at me for forgetting.
Tortoise also add small icons over the files in Windows Explorer, unversioned files have a blue question mark over them and it's quite easy to spot them and remeber to add them.
Tortoise does have a command to show the unversioned files. There is a check box for it at the bottom of the commit dialog.
There are also several plugins for integrating svn into Visual Studio like VisualSVN and Ankh
As well as "show unversioned files", as others have mentioned, Tortoise SVN also lets you add the versioned state as an explorer column, which you can sort by. I've found this to be useful to visually see unversioned files in one place in a directory listing - but obviously only one folder at a time.
In either case, it's best to use these in conjuction with svn-ignore (which Tortoise makes easy), so you don't get binaries and other generated files showing up as noise.
When you commit, TortoiseSVB shows a list of all unversioned files, if you enable the checkbox for it.
SVN also has add-ons for Visual Studio. AnkhSVN is one on the top of my head.
You already said it: Tortoise has a
show unversioned files
checkbox to the bottom of the commit dialog and the "Check for modifications" window.
The solution I use now is the following.
When I need to add files to a project I of course use the "Add existing items" dialog, but this dialog shows files exactly the same way as Windows Explorer does and I can run any Tortoise SVN commands there. So I just do "SVN Add" there and then add files to the project.
Are there any good techniques to help us know which branch (or trunk) our working copy is from? We recently converted to Subversion and we're using release branches. I had two developers commit changes to the release branch that should have been committed to the trunk. We're using CI (TeamCity), so I recognized the problem right away and was able to revert the changes but I'd like to prevent it from happening again. From within Visual Studio, especially, it's easy to make a mistake and commit to the wrong branch.
We're using TortoiseSVN and AnkhSVN.
Edited to add:
Just to clarify, I'm looking for a method to prevent careless mistakes, I already know how to find this information. There are two careless mistakes I'm trying to prevent:
Doing work on the wrong branch. If this is caught before commit, the developer has to merge the changes back into the correct branch.
Committing to the wrong branch. This combines the pain of point 1 with having to revert the changes in Subversion.
Edited to add: We just made the switch to the VisualSVN VS plugin and it has a toolbar that displays the path of the current working copy. I really like the reassurance that I'm working on the right branch.
Perhaps you should consider using a pre-commit hook: http://svnbook.red-bean.com/nightly/en/svn.reposadmin.create.html
Then you could do something like only approve checkins that have 'for release' in the comments for that particular branch or something like that and return an error message otherwise.
In AnkhSVN (in Visual Studio) the project url of your working copy is from is displayed in the 'Working on' field of the Pending Changes Window (View->Pending Changes).
The url of a file/folder is also displayed in the Visual Studio project window when you select a file in the Pending Changes Window or Working Copy Explorer (and in many cases even when you select a file in the Solution explorer; but this depends on the project type).
[Update: I just added AnkhSVN issue #581 for extension of the commit dialog.]
Tortoise SVN adds columns to the Windows Explorer view. In "Details" mode, right-click on column headers to get a list of available columns, at the bottom, select "More" to get a dialog of all available column types.
SVN short URL should quickly show you what the location is in the repository.
But this doesn't appear to work under vista ...
Right click the folder, move to the subversion tab, there it says the project it's linked to.
Also, in the commit dialog, it says so at the top of the dialog.
From the working directory:
svn info
URL will contain the branch your working directory points to.
<EDIT> Seeing how many people dislike the command line, the closes thing I found from TortoiseSVN is the "repo browser" which seems to use the selected branch as your starting path in the repo. </EDIT>
Avoid re-using working copies. If you're working on 2 places in the repository, have 2 working copies, named appropriately, like: Project-trunk, Project-release.
Here is a simple idea which might help:
Create an empty text file named "branch_XX" (or any name) and add it to your branch.
commit this and then when you switch to the trunk, the file will not appear in the solution explorer.
It sounds stupid... but it does the trick.
I really hope they will add something that might mark what branch we are using without going to other windows.
In AnkhSVN (in Visual Studio), right click on your project/solution, then Source Control -> Subversion -> Select in Repository Explorer. It will automatically select the branch you're currently working on (i.e. the branch you're switched to).
I don't think that the accepted answer for AnkhSVN works for Projects, since I always see the same URL in the "Pending Changes" even after I use the option "Switch Project" on a project.