Search icon CANCEL
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Visual Studio 2019 Tricks and Techniques

You're reading from   Visual Studio 2019 Tricks and Techniques A developer's guide to writing better code and maximizing productivity

Arrow left icon
Product type Paperback
Published in Jan 2021
Publisher Packt
ISBN-13 9781800203525
Length 386 pages
Edition 1st Edition
Languages
Arrow right icon
Authors (2):
Arrow left icon
Aaron Cure Aaron Cure
Author Profile Icon Aaron Cure
Aaron Cure
Paul Schroeder Paul Schroeder
Author Profile Icon Paul Schroeder
Paul Schroeder
Arrow right icon
View More author details
Toc

Table of Contents (21) Chapters Close

Preface 1. Section 1: Visual Studio IDE Productivity Essentials
2. Chapter 1: Flavors of Visual Studio FREE CHAPTER 3. Chapter 2: Keyboard Shortcuts 4. Chapter 3: IDE Tips and Tricks 5. Chapter 4: Working with a Repository 6. Chapter 5: Working with Snippets 7. Chapter 6: Database Explorers 8. Chapter 7: Compiling, Debugging, and Versioning 9. Section 2: Customizing Project Templates and Beyond
10. Chapter 8: Introduction to Project and Item Templates 11. Chapter 9: Creating Your Own Templates 12. Chapter 10: Deploying Custom Templates 13. Section 3: Leveraging Extensions for the Win
14. Chapter 11: Overviewing Visual Studio 2019 Extensions 15. Chapter 12: Overviewing VS Code Extensions 16. Chapter 13: CodeMaid is Your Friend 17. Chapter 14: Be Your Team's Hero with CodeGenHero 18. Chapter 15: Secure Code with Puma Scan 19. Other Books You May Enjoy Appendix

Stashing (and applying) your code

There are a few scenarios where it makes sense to make a temporary, local copy of your changes. Sometimes you are in the middle of working on a feature and the following happens:

  • Another priority comes up, requiring you to shift gears and quickly fix a bug.
  • You have to review a pull request (covered near the end of this chapter) and need to check out a different branch.
  • The code is working, but not quite the way you want it to and you want to do potentially risky refactoring.

In these scenarios, the stash function (git stash) can be a good option to use. This allows you to save the state of the code you are working on for now and look at the original branch, or switch to another branch, without any pending changes.

In the following screenshot, from Visual Studio 2019 for Windows, an optional message is entered to describe the stash and then either Stash All or Stash All and Keep Staged is clicked instead of Commit Staged:

...
lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at €18.99/month. Cancel anytime