• About Morris Development
  • A Focus for Cloud Efficiency
    • Microsoft Azure
    • Amazon Web Services
  • What our Clients Say
  • Our Products
    • PreschoolDB
    • WebinarDB
  • Contact Us

Morris Development

Custom System Development and Integration

January 24, 2022

Common Git Tasks

We all know how to commit, but the two most important things to know is how to work with a branch and how to undo a screwup.

Rolling Back.

There are tons and tons of ways to do this, but I have found the most intelligent and understandable way to do it is by using the following method:

How to restore from a previous commit

  1. Open the branch:
    git checkout features/my-branch
  2. pull from origin to make sure you have the latest
    git pull
  3. checkout the exact commit you want to roll back to, but be careful and make sure you have the trailing period (you don't need the entire sha)
    git checkout 2de0a898 .
  4. all the differences should now be in your working directory as if you made them onto the latest pull. So, just commit them
    git commit -m "restoring from prev commit 2de0a898 "

We’ve probably all committed something, realized we didn’t mean to do that, then gone onto github or devops and just cut-pasted the last commit on top of our regular code. Then it shows the change in our staged changes, we commit it as a new change and we’ve essentially “rolled back”, when the reality is that we just typed over the previous commit and made a new commit. But, sometimes you have 50 files that have changed. That’s not so easy. By checking out the commit hash that you want to go back to, but appending a period at the end, it will actually write over the files in your current directory with that commit. So, it’s basically pasting those files right on top of your working directory without actually leaving the branch you were in.

Then, you can just put in a message and commit them. Then, you haven’t lost anything, you’re not fiddling with the HEAD, you’re not going to mess up other developers, etc…

Article by MacGyver / Angular 2

About MacGyver

I've worked with database systems for over 20 years, and started my own company in 2000. Almost all my business consists of internal database systems, either ERP or CRM. My programming is primarily in Angular / Microsoft C# and MS SQL.

About This Site

Morris Development has been specializing in internal database system design and integration since 1999. We provide long-term management and support of secure data systems for many businesses as well as developing the more complex code structures for ERP systems like Intellievent, Apidas, and AVMS.

This site is primarily for our developers to keep track up various technologies and updates that are used by Morris Development.

Training

Integrating Angular Microsite with .Net

Private Data Caching with Google Storage

Continuous Deployment for Production Releases?

Azure Websites – the perfect Angular host

Angular 2

  • Angular 2 Authentication
  • Angular Command Line Interface
  • Material Design for Angular
  • Using Observables in Angular 2

Mentors

  • Ben Nadel
  • Dan Wahlin
  • Deborah Kurata
  • John Papa

Staff

  • Dan Morris

Training

  • Google Development Courses
  • Microsoft Virtual Academy
  • PluralSight
  • Test Deep Links

© 2025 · Morris Development