I've accidentally checked in some changes in a change set and I don't want to deliver them.
How do you move a change from a pending changeset to unresolved changes in RTC?
The usual option is "discard", but that would remove the changes (it actually remains in the repository, but is not listed in any folder, so it feels like your changes just vanished).
What I usually do is:
backup first those files (somewhere outside the sandbox or local workspace)
discard
copy back the files in the sandbox
refresh the sandbox.
The help page mentions another tip:
To make it easier to retrieve a discarded change set that does not exist in any other stream or workspace, you can associate it with a work item before you discard it and then accept it from the work item later.
Related
I'm on IntelliJ 2019.2.4 (Ultimate) I'm not sure of the version I upgraded from, but it was from 2018 for sure. I noticed this annoying changelist below my default changelist in a very click-baity way, and I can't find a setting to get rid of it. Trying to delete it prompts me to delete the actual file in that changelist, which I don't want to do. It's nothing I've set up, and seems to be something IntelliJ is doing automatically.
(For posterity/if the image dies, my screenshot shows my changelist with some files I changed in default, and then a second, unwanted changelist below that says 'People who change the files in the active changelist also change:
The node you see is not actually a changelist, and there are no changed files inside it. It lists files that, based on your project git history, are usually changed in the same commits as the files in the active changelist, and appear related to the changes you applied.
The purpose of this node is to suggest some files you might want to change and commit in addition to already modified files, so there is no need to amend or create a new commit with these changes later if the files do need to be modified as well.
If you don't want to see it, just disable the Show files related to the active changelist option under the Eye in the Local Changes toolbar. Disabling the ChangeReminder plugin would also work, but is unnecessary.
Is there a way to temporarily hide or remove a file from Intellij? I used to work in c# and I remember there was some way in visual studio to temporarily remove a project from the build then add it back later. I am just trying to figure out what parts of code are necessary for certain features.
This is a perfect use case for git stash.
If you're not using a git repo, hit Ctrl+Shift+A and type "Create Git Repository", then hit enter to initialize git tracking on your current project.
Initially, you'll want to add your important files to git. Hit Alt+1 to navigate to the Project View, then select all the files.
In order to add a file to git, press Ctrl+Alt+A, you should see the filename turn from red to green. It is now being tracked.
Now you'll want to make your first commit. Hit Ctrl+K, and IDEA will guide you through this.
Finally, once everything's all checked in, you can start messing around a little. If you make a few changes, say delete a file, and want to temporarily revert to the last commit, hit Ctrl+Shift+A, then "Stash". Select "Stash changes", write a little message for yourself, and you'll immediately jump back to the last commit.
Now say you want to go back to those changes you stashed. Hit Ctrl+Shift+A again, type "Unstash" then select "Unstash changes". Find the stash, check "Pop stash" and hit Enter.
This is a pretty common workflow for temporarily saving, removing and reverting changes in Git. You can read more about git stash here, and version control on IntelliJ IDEA from Martin Balliauw.
In vim I can type :e and reload a file's contents from disk overwriting any changes I've made. It's a nice way to reset in case I've gotten lost or just want to undo all my changes. This obviously doesn't take into account any kind of refactoring, I just want to nuke all changes to buffer. Not even closing and reopening a tab will work.
How do I do this with Intellij IDEA? I'm using Intellij IDEA Ultimate 13 and I've disabled any kind of auto save.
File > Synchronize (Ctrl+Alt+Y)
It will load the file from the file system. If you have unsaved changes, it will ask if you want to discard them.
⌥⌘Y - Synchronize for Mac users
What I do in a similar situation:
Simple - Ctrl+Z, Ctrl+Shift+Z many times to quickly navigate the editing history
VCS rollback - either for the whole file or for the area being edited (by clicking green areas on the left)
Local History. Well, yes, for you case it's granularity is not sufficient, so first might be an option
There is also an option to put a label into Local History if you need to rollback to a specific point in time.
For those who use autosave - it is being triggered when code editor loses focus. So doing Alt-Tab during long editing without compiling or running the code makes sense.
Open the file in another editor, make an insignificant change and save it. PHPStorm will ask you what to do because the file system and in memory copies of the file have diverged. Click "Load File System Changes".
Note, I was unable to use my undo history as it had become corrupt.
Since what I want isn't really possible I wrote an extension to do it for me:
https://github.com/btipling/DiskRead/
I'll add it to the Jetbrains plugin repository, it's called "DiskRead".
I wrote a blog post about how I created this if anyone is curious.
So I add new files to my project. At this point IntelliJ pops up a dialog asking me if I'd like to add these files to git/mercurial/svn etc.
I will always say No at this point because until I've fleshed the files out a little, perhaps got them to work with some context, perhaps decided to rename them, I'm not happy to add these new files to version control. Even if I can still rollback the 'add', I have to bare in mind the nuts and bolts of the underlying system. It's safer simply not to do it.
Now I'm ready to commit, I bring up the commit dialog box and the new files are nowhere to be found! If I go on a scouting expedition for them, I can add them individually from project files but this is error-prone.
How do I automatically get a list of all my new files which I previously delayed adding?
I found it, under the changes tab. I was looking for it only under the version control context menu from project files.
How can I access previous checked in versions of workspace repository?
I just seem to be able to compare against the latest changes sets delivered to the stream. Can I also view/compare previous version of a file which has been checked into my repository workspace ?
You can display the history of a file checked in by right-clicking on ("Show History").
From there, in the "History" view, you can right-click on any version and select "Compare to" with any other version (not just the previous one).
As explained in this thread, you can access (open) the content of any older version you want, which gives you the opportunity of replacing the current version with said content, should you want to revert back for just one file.
Rolling back would be a slightly different issue:
If the change set that created the current version contains only that version, then you can replace the current version with the previous version by discarding that change set.
But if that change-set modifies multiple versions, you cannot roll back just that file. Work Item 59688 requests the ability to "split" a change set, so you can move this change into it's own separate change set (and then you could roll back the change to just that file).
Note that the history will be by default the one for that given file done in your repo workspace (checkins) or in your stream (deliver).
The same "show history" done at the Component level (when you right click on a Component, in the "Components" section, and select "Show Repository files", would give the full history (done on any Stream), but wouldn't display the history done on repo workspace (chekins).
Note also that only RTC4.0 has "Checkin history"
This is essentially the history of a file within a change set.
Each time you check-in a file into a change set, the content is stored in the repository. Normally you see only the final version of a file within the change set. But sometimes you want to go back and see what the intermediate versions of the file were. Check-in History is an expansion of the changes made to the file each time it was checked into a change set.