I've just shelved a bunch of changes. I forgot to untick the "Preserve pending changes locally" checkbox...
How can I effectively revert my changes to how they were before I started work on them?
Just "undo checkout" on the files you shelved.
(As long as you are sure that they are safely stored in a shelveset)
Related
I made some changes to a few files within VS 2019.
I added a comment and clicked Commit All under Git Changes tab (didnt do a Push).
I realised i made a mistake by including some temp files so i clicked Revert under Git Repository Explorer against the comment i made.
All my changes have been lost in VS 2019..... Is there anyway to recover my changes?
Managed to resolve this after panicking a bit!! Just in case this helps anyone
Clicked Git in the VS 2019 menu.
View Branch History.
Under Local History, i right clicked the row where i made the changes and added my comment.
Selected Revert > accepted the warning
All my work was restored. I then continued to do the usual Commit and Push which then pushed my changes to the repo and i was able to verify that.
What I want to do: I made some changes in code and I want to make some kind of "checkpoint" (like git commit), then continue working and being able to simply undo changes to last "checkpoint". I don't want to use Check In.
If I'm not mistaken, it could be done by Shelving, but I'm unfortunately not sure how exactly I can achieve that.
Thank you.
In the "Pending Changes" tool window in Visual Studio just select "Shelve" at the top, enter a name and click the "Shelve" button:
To go back to your "Checkpoint", restore your Shelveset via Actions => Find Shelveset => Rightclick => Unshelve
Shelving is similar to stash in git. To replicate that kind of workflow would involve either checking out to a previous changeset and/or rolling back changesets. I've created multiple shelvesets before (V1, V2, etc), but it is less than ideal.
I am new to using TFS source control.
I have a large project which I have been porting from SVN. I am checked in and up to date with all projects. However, I opened up Visual Studio today and all project items are in the pending changes included window even though there are no changes.
I haven't touched or edited any of the files for my TFS files since last time.
To verify, I used Araxis Merge to do a folder comparison and can see that no actual changes have taken place.
Why are these unchanged files appearing in my check-in window?
Here is an example of a diff in visual studio from the previous version:
I can't see anything!
Hopefully this shows my local workspace
When you create or edit a workspace, you can specify whether its location is Local or Server. Local Workspaces are TFS's attempt at DVCS and actually gives you a much more SVN-Like experience.
Edit the workspace and choose advanced, you could see the Location of workspace type.
Maybe formatting, line endings, encoding. Do a diff using Beyond Compare or something to see what changed.
If nothing changed, check if you are using the same workspace. You may select another workspace than you used.
In Source Control Explorer, check if you choosed the workspace the workspace you were work in.
If all above not work, you could also try this workaround, select all the files in "Pending changes" window and activate the context menu. Then click "Undo..." > "Undo Changes" > "No to All".
The files without changes will be rolled back. More details please take a look at this question: how to undo pending changes of files that are unchanged?
I did something no self-respecting developer should do and paying the price for it!
I ran a line count util in my project which created a bunch of files to show line count stats.
I then removed them manually from the folder. Now those files keep showing up in "Pending Changes" every time I try to check my code into my VSTS repository -- see below. But those files are not there at all.
How do I remove those non-existing files so they don't show under "Pending Changes" anymore?
This happens because of a behavior of VS.
You have to selected the files you don't want and choose "Undo pending changes" on the context menu.
For some unknown reason, the physical file and the pending change are not synchronized when you first delete them, without undoing changes first. Which I believe is what you did.
What is the point of the following message after gated check-in? It doesn't make sense to me. "If you did not undo your local pending changes when you submitted your check-in, you may need to reconcile your workspace with the repository."
Let's say you are performing a Gated Check-in of a Single file - Progam.cs.
When you perform a Gated Check-in and choose not to undo your local changes, you Shelve Program.cs to the server and perform a build with the Latest code + that Shelveset. If the build succeeds, then TFS automatically Checks in the shelveset (containing your changes to Program.cs) into the source control.
Now, because you didn't undo the changes on your local workspace, you will still have Progam.cs as a "Pending Change" with the status of "edit". This "edit" is not needed as TFS has already checked in your change. Clicking "Reconcile..." will undo that local change and bring it in line with what is on the server.