Writing legacy code and a few git commands

I’m having a blast learning Ruby and Rails right now.

I’m building a site as a learning exercise, but I decided to learn by building the Maintenance App that I previously wrote about.

I don’t believe that Ruby or Rails will be the way I want the app to run in the end, but it’s still a great learning exercise. Essentially, I’m writing “legacy code” now that will probably be replaced with a one-page JavaScript app. That will be another great learning experience, including how I maintain a set of automated tests through the transition and always have working software.

Here are also a few git commands that I’ve been using. I doubt that I’ll forget these anytime soon, but this might still be a handy reference for me in the future:

Reorient by getting the latest info from GitHub and looking at the branches and status I’m working with locally

git fetch
git branch
git status

Start a new feature branch and commit to it

git checkout -b feature_branch_name
git status
git commit -a -m "Describe changes made in committed changes"

Rebase before pushing to GitHub (to create or update a Pull Request)

git pull origin
git rebase origin/master
. . .
git add .
git rebase --continue
. . .
git push origin --force

Abort a rebase if I messed up

git rebase --abort

Wipe my local changes and go back to the feature branch on GitHub

git reset --hard origin/feature_branch_name

Closing out a feature branch after it has been merged in GitHub

git checkout master
git pull
git branch
git branch -d feature_branch_name
Writing legacy code and a few git commands