SECRET OF CSS

My Git Analogy Moment. A better reference for modern times… | by Nevin Katz | Aug, 2022


A better reference for modern times with a quick list of commands we covered.

1*poVqhn3nbvTSeNlajRO8yw
Photo by Roman Synkevych 🇺🇦 on Unsplash

I just had a terrific experience teaching Git while tutoring a middle schooler in programming. While my student has been coding in Python for several years and has a Github account, he has not yet started using Git.

After introducing the general purpose of version control, I shared my screen and ran him through the various commands that I use from day to day. He seemed surprised I was using the command line for everything, though I showed him you could get to the files with the graphic interface. I then showed him my Github account, created a new repository, pushed up my main branch, and showed him the result.

I then introduced the topic of Git branches. I created a new one, made a change, committed the change, and pushed it up to the repo. To make the concept a bit more understandable, I explained branches as “alternate realities” that can diverge from the main branch. For my colleagues at work I have used the alternate 1984 from Back to the Future II as the analogy when I explain this, but this time I held back. Given that the student was in middle school, the odds of him getting the reference were 3,720 to one.

After explaining the “alternate reality” idea to the kid, he said, “oh, so it’s like the Multiverse!” It what a great moment. We then related it to Spiderman and talked about how the different Peter Parkers lived on different “branches.” I anticipate I will be modifying my approach now with this new analogy. Yes, I said, a Github repo can be thought of as a small multiverse!

Below is a quick list of the commands we covered in case you find it helpful in your own work.

  • git init starts a repository.
  • git add <file> stages files for a commit
  • git commit -m <message> makes a commit
  • git status prints the status of files
  • git diff tells you what has changed in a file since the last commit
  • git branch, which prints your local branches and highlights the current one
  • git checkout <branch> will check out an existing branch
  • git log shows you a log of all your commits
  • git push origin <branch> pushes your changes
  • git remote add origin <remotepath> adds a remote origin
  • git clone <remotepath> allows you to clone an existing repo, depending on permissions

Good day!



News Credit

%d bloggers like this: