Git Rebase

It was pointed out to me that I had a typo in my code for the SPI shift register tutorial. I had the definition wrong for the data pin used by SPI (I guess AVR is not too particular about setting MOSI as an output for master SPI mode). Since it is supposed to be a clear example I needed to fix it. But the git repository that I used has a tag to some earlier code as the simple example, then more complex code at the latest revision. I wanted to make the change throughout and for this I decided to use the Rebase command. Here’s the steps I took:

  • Check out a new clone of the repository
  • Do a hard reset to the offending commit
  • Fix the problem and commit it
  • Hard reset back to the most recent version
  • Use the Rebase command to bring that change forward in time
  • Pull from the remote repository (you’ll be told to do this if you try to push first)
  • Push back to the remote repository

Fixing tags

  • You CANNOT move a tag on the remote repository. This is a security feature.
  • Delete the old tag and make a new one at the proper commit.
Take a look at the actual commands after the break.