#postyourprompt

 Let’s have a little fun on a Friday. What’s the command prompt on your local machine?

via Ryan

I use Zsh, so I also have a right prompt. Most of this is pretty obvious, but I’ll explain some of the cooler things that might not be.

  • dashboard is the current branch I’m on in a git repository
  • fda1011 are the first 7 characters of the hash of the current commit
  • The X means there are uncommitted changes
  • The arrow is green when the return code of the last command was 0 and red otherwise
  • cd automatically calls ls as well

It’s all available on Github.

Git essentials for SVN users

Coming from Subversion, the extra steps involved in working with a Git repository can be confusing. Here are some basic concepts and commands to get started with Git.

I find that actually doing something is the best way for me to understand. If you’re the same way, the Github tutorial by Code School is great.

Concepts

There are a couple conceptual differences between Git and Subversion that it helps to understand before getting started.

Centralized vs Distributed

Subversion is centralized version control — every commit lives on a central server. Git is distributed version control — everybody has a copy of the repository. When you commit to subversion, the push to the central server is implicit. The commit and push are discrete actions in Git. This means you can do work and commit changes without necessarily being connected to the Git server. Another advantage is the ability to make commits locally without necessarily publishing your work.

File vs Change-based version control

Subversion is file-based — when you make changes and run svn commit, it commits all the changed files by default. Git is changed-based — when you make changes, you have to run git add to “stage” changes. You can get similar behavior to Subversion with git commit -a. The “a” flag tells Git to add all changes in tracked files.

Commands

  • init – Create a new repository.
  • clone – Set up a repository that already exists on a remote server.
  • add – Stage changes to be committed.
  • commit – Add changes to the local repository.
  • push – Push unsynced commits to a remote repository.
  • pull – Pull unsycned commits from a remote repository.

Basic Workflow

  1. Get the latest version of the code. If you already have the repository, you can use git pull to get the latest changes. Otherwise, git clone will download the code from a remote repository and set it up locally. If this is a new repository, you can set it up with git init.

  2. Make changes.

  3. Share your changes. git add <file>; git commit; git push or git commit -a; git push.

Hour of Code

This week 15 million students learned to code.

A friend of mine called me Wednesday night to ask if I was available to talk to some of his high school students about Computer Science and hangout while they worked on the Hour of Code. They have no Computer Science curriculum so this could be one of a few times they could experience Computer Science first hand in high school.

I didn’t really know what Computer Science was when I started studying it, so I think getting kids exposed to it while they’re still deciding what they want to study can only be a good thing.

We started by showing a promotional video for Hour of Code.

Then they started programming.

One group got in way over their heads. I noticed right away that they were writing Objective-C, so I asked if they had written any iOS apps, or even had any programming experience. They didn’t. My first thought was that starting with Objective-C without any experience would be pretty hard, but I offered to answer any questions they had. The next time I walked past, they flagged me down. They needed to instantiate an object.

Again, I thought it would be pretty hard to write Objective-C without understanding what Objects are — or, even the basic things you learn in the first week of any programming class. I gave a basic description of objects and helped them move on to the next step.

The next time I walked past, they had a ship flying on the screen and were working on creating a guy to shoot at the ships. They asked me a few more questions throughout the hour or so that I was there and by the end they had gotten pretty far through the iOS tutorial with ships flying back and forth and a guy to shoot at them when you tapped the screen.

It was a fun day answering questions about Computer Science and hopefully convincing a few of them to dig into it some more on their own.

Minneapolis