![]() It’s also possible to label a specific point in time, for example right before we start a massive refactoring effort. a solution folder, files can be restored. Doing so will update the file that is open in the editor, or in the case of e.g. Just like in a regular diff/merge view, we can restore lines and blocks of code, or roll back to a previous version of the file. On the right, a diff between the current and previous version is shown. It will bring up a diff viewer where we can see a list of changes made to the file we have open. On the left, we can see a description of the changes. One place where we can view local history is under the VCS | Local History | Show History menu. It tracks changes in a solution or project, folders within our solution, files, classes, … As long as the file is text-based, Local History has it covered. Local History is enabled by default and keeps track of all every save (or delete), whether explicit ( Ctrl+S) or implicit (Rider auto-saves every few seconds). Accidentally deleted a folder of files that weren’t yet committed? Want to get back that class or entire namespace you wrote on the train commute home from work, was dropped a few minutes ago and never committed to source control? Local History! Whenever something changes (and is persisted to disk), local history tracks the change and allows us to roll back (or forward). This is where Rider’s Local History comes in: it keeps track of source code changes and file changes in our project in between VCS commits. What’s even worse: don’t you hate it when you undo 20 times, then accidentally press the keyboard so you can’t redo anymore? Undo also does not track external changes, made outside of the IDE. If we’re lucky, changes in between commits are captured in the undo stack, but that disappears if we close the IDE and reopen it a later time. ![]() Unfortunately, commits to the VCS are just snapshots. ![]() We write, refactor and debug, and when we finish a task, code is committed to a version control system (VCS) like Git or Mercurial. When we’re “in the flow”, our project and source code constantly changes. It’s a real-time, local version control that keeps track of changes we make to our code base. In JetBrains Rider, there’s a solution to that: Local History. How can we roll back to it if we did not commit it to Git or Mercurial? How can we roll back any change we made to the code base between source control commits? Undo only goes so far… Rinse, repeat, and two hours later we realize that first attempt needed just a little tweak. Investigating a bug, making some code changes, then finding that these changes don’t fix the bug.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |