I have used "Revert changes from this revision" and i now want to redo these changes again. The reason that i used "Revert changes from this revision" in the first place was that the code was bad so i need to redo it with few minor changes.
What's the best approach to do this ?
I should mention that i can't use "Revert to this revision" since other changes has been made which i don't want to revert to. I just want to have the changes back from the specific version that i reverted.
/Mihai
You can Export the files from the revision that has the best approach of the file, then overwrite the files from the revision to be changed.
Use the Diff function to review the code and revert block by block the undesired changes.
Related
I had a functional version of code which I was trying to commit to my local branch,
However, previously I tried to make some changes that were not accepted on that branch. So I reverted back to a previous commit.
So I was working out of a commit that was 2nd to last in the branch
Then I made some more changes, tested the program, and tried to commit again,
Then tortoise svn forced me to update, I assumed it was updating the files for the current revision I was on. But no, unfortunately, it Updated the files to the Latest commit, which I did not want, then it tried to merge my changes on top of that, so I had changes that I wanted on top of changes that I didn't want merged together!
Can I undo this and keep my changes that I just made that I wanted to commit? What did I forget to do, was I supposed to stash all of the newer commits?
Right click on file you will have option replace with choose the local history. Select the local version you want to keep.
Its done. You are good to go :)
Is there a way to undo/delete the last commit in TFS. I don't want to rollback because as far as I'm aware this creates a new changeset that does the inverse..
Ideally I need the equivalent of a git reset so the changeset is trashed but my changes are preserved locally..
Is this possible in TFS?
Nope, there is no way to undo a changeset except for rollback which is a new changeset by itself.
A changeset is a permanent part of the history of your version-controlled items and cannot be undone or removed.
MSDN LINK
Nope, the change cannot be cancel.
However (if it is not a binary file) you could set the file content back.
You could copy text of the previous version from file comparison feature in TFS.
To do it, go to commit you want to revert, then open the file you want to revert back.
Then paste it to the same file in local, then push it to your repo.
You could undo change to the local file after committing.
Hope that could help.
Is there any easy way to exclude a specific changelist from p4 sync?
I want to sync up my code, but I don't want to fetch the changes from changelist #1337
Like: p4 sync //depot/source/... - //depot/source/...#1337?
The best way to accomplish this is just sync to head, and then use the 'Back out submitted changelist' function in P4V ('Submitted' pane, right-click the undesired changelist, select 'Back out submitted changelist').
This will create a new pending changelist in your workspace with the undesired changes removed.
It is possible by syncing to a range and using two commands to "skip" the changelist.
p4 sync //depot/source/... - //depot/source/...#0,#1337
p4 sync //depot/source/... - //depot/source/...#1337,#head
Note: you may have to specify the changelist on either side of the one you want to skip - not sure if the range is inclusive.
HTH,
Dennis
Ok this should work depending on what you want to do. Man I really miss git :(
If you simply want to sync and temporarily ignore a changelist you can do what the first reply said and back out the change list. Just remember to not check that change list in unless you want to wipe out the ignored changelist for the branch. However this approach will not work if you need to make changes to files that exist in the ignored changelist.
If you need to work with the same files from the ignored changelist you can do the following. One thing to note however, is that the ignored changelist will be pulled out of the remote branch until you are ok with them being in your code. (there is one other option but requires someone else to do something)
If you want to ignore a change list, and not get rid of it completely but simply be able to work on your code with it off to the side, the following will work.
Back out the changelist as previously stated.
Submit the backed out changelist to wipe out the changes in the remote branch. (don't worry)
Now do another back out but this time back out the chagelist created by the previous back out and shelve it. This back out of the back out will be a pending change list that is basically a copy of the one you wanted to ignore. Once its shelved you can go about your work, even in the same files. The down side is that now the ignored changelist only exist on your work space and its up to you to submit it or decide what to do with it at some point.
You can keep the ignored change list shelved until you know what you want to do with it. If, after you work on your code, you want to re integrate that chagelist and merge it with yours you can simply unshelf it and resolve conflicts.
So the (other option)
You could do the above with help from another dev with a perforce account (perhaps the one who's changelist you want to ignore) in this case you could have them back out the changelist and submit, then you could sync, then they could back out their back out. In this case the remote branch would not need to stay in weird state while you worked on your code. The big downside is, that you would have to do this every time you wanted to sync.
A better option would be branching before an issue like this arrises but that is not as easy or light weight in perforce as it is in git.
Hope one of these options help or spark a finale and perfect solution from some one else.
I'm rather new to perforce, but have quite a bit of other VCS experience...
Imagine this:
You submit changes (changelist 1)
A colleague submits changes on the same branch, accidentally overwriting your changes. (changelist 2)
I tried integrating (which P4V refuses to do since it's already integrated) and looked around for a way to just generate a patch that I could apply, but couldn't find anything.
For now, I will check out the versions in question and use an external merge tool, but it would be great to know if perforce supports this somehow.
Is there a way using the perforce tools (preferably in P4V) to reapply changelist 1?
You can't reapply changelist 1, but you can reapply changelist 2.
Sync to changelist 1.
Check out the file(s). P4V will warn you that, "You do not have the latest revision of the file.", and ask you if you want to get the latest. Ignore the warning by clicking the "Don't Get Latest" button.
Now sync to the head revision (I'm assuming changelist 2 corresponds to the head revision). The file(s) will now need to be resolved, which you (or your colleague) can do, properly this time, without clobbering the changes you made in changelist 1.
Probably the easiest way is to retrieve the changes from changelist 1 (//depot/...#1,#1) and then going through the normal resolve/merge+submit song and dance.
I did a search it said to view the log, right click the revision I want to go back to and select revert to this revision but I always get this error:
Cannot reverse-merge a range from a
path's own future history; try
updating first
You need to Update your working copy first. You will then be able to revert the revision.
Have you tried doing an update (on your checked out copy) first?
Note that you cannot undo a commit in the sense of completely removing it from the repository.
What you can do is to get the state before the commit, and check that in as the current state. This is probably what you found in your search, and what Ben Lings's answer refers to.
Other than that, Ben Lings is correct. Update your working copy, then retrieve the old version (that is the "revers-merge" part), then commit that.