Stay And Code Please…….GIT Mnemonics

I first heard about Git early in 2017 when I started learning web development in the Skillcrush Front End Developer Blueprint. The online instructor’s video said it was version control for projects which I thought was pretty interesting. But as the video went on and talked about branches, masters, pushing, pulling, fetching, repositories, commits, merging, initiating and cloning I thought I was learning about some weird science/math project.

 

For me, I have to find interesting ways to retain information especially repetitive information.  I heard “Commit often” many times so i knew this was going to be something I just had to get accustomed to doing.  I came up with a mnemonic to remember the steps to “commit often”.  I remember learning a mnemonic for the planets back in elementary school a long time ago and I still remember it: Mary’s Violet Eyes Make Johnny Stay Up Nights Permanently.  So why not for the GIT command sequence to commit my code?

 

Stay And Code Please

 

First up is Git Status:  this is where I checked to see what files have and have not been added to the local repository in preparation to be committed.  Git Status can be done anytime but I like to start off with it just to make sure my changed or added files are showing up.

Next up is Git Add: there’s a few add commands but this is the one I first learned so it’s the one I use most often.  It adds all files in the list you received after running the git status command.

Then there is Git Commit: This is the command that commits the changes and prepares them to be moved to your remote repository (i.e. GitHub).  The verbiage within the quotation marks can be anything descriptive regarding the changes you’ve made.  The first time doing this, when there aren’t any changes, I just usually say “first commit”.

And the last step is the Push:  this command actually pushes the changed (or added) files in your local repository to your remote repository.  ‘Git push’ is the command while ‘origin’ is the name of the remote repository and in my case here, ‘kata2’ is the name of my branch that I’m pushing to the repository.  For security purposes I have my account set up to ask for a passphrase that verifies my access into the remote repository.

Of course these are not ALL of the commands or steps in working with GIT but these are important repeatable steps that you’ll find yourself using even if you aren’t collaborating with a team just yet.  These steps are good practice and the “Stop And Code Please” mnemonic can help you remember the main basic steps and the sequence to getting your work onto the remote repository.

Leave a Reply

Your email address will not be published. Required fields are marked *