Scary Git Commands Made Easy with Terminal-based Micromaterials
Tags: git, micromaterials, tutorial, terminal
Published: 2020-09-10 09:57:21

`rebase`, `reflog`, `submodule`...these git commands can seem very scary and unapproachable when you first hear about them. They definitely seemed that way to me.

Since I had been avoiding `rebase` for that very reason, the first time I actually need to use it in my professional life as a developer was very stressful, and thankfully I had a much more experienced git user to pair with while doing it.

It definitely DOES NOT have to be that way.

## Existing resources

There are an overwhelming number of free resources online to help learn about every conceivable git command, so why add more?

While there are many informational resources (such as the excellent [documentation on rebase](https://git-scm.com/docs/git-rebase)), these can tell you a lot "about" git, but they don't necessary tell you about the process of actually using it.

In addition, there are also numerous tutorials that do actually guide users through the process of using these commands. Though by necessity, they tend to be very broad, speaking about rebasing in general rather than presenting one very specific objective detailing the context around why you would want to do something like `rebase`.

I'd add that I'm sure a lot of git users have learned perfectly well using these kinds of resources, and if they're adequate for your purposes, by all means, go ahead and use what works.

Personally, I always found them to be a bit lacking, so I decided to just make the stuff that I wish existed.

## Micromaterials for git

My aim was to create some very simple learning materials, which were very specific, open-source, and fast. I also wanted to focus on learning by doing, involving actually typing out the git commands in your terminal to see what happens.

Unlike a situation involving a time-sensitive project at work, using these commands in your own local environment is very low-pressure, you can go at your own pace, and making a mistake is no big deal.

- for `rebase`, I made https://github.com/lpmi-13/rebasic, which asks you to just remove two commit messages while keeping the commits themselves. I do this all the time after finishing work on a feature branch and before opening a pull request.

- for `reflog`, I made https://github.com/lpmi-13/reflog-power, which simulates deleting a local branch and then bringing it back to life. This is also something that I didn't know was possible until I accidentally deleted the local branch with all my work, and then I had to get it back.

- for `submodule` I made both https://github.com/lpmi-13/submodz and https://github.com/lpmi-13/snubmodule. The first one involves a very basic scenario of updating a submodule, and the second one deals with moving a submodule into your main repository. I don't do much with submodules, but I did have to update one in my job recently, and it took me a long time to figure out what to do.

## Whatever works

In such a wide field of software development, involving so many different types of people, there can never be one learning resource that works for everyone. Whatever works best for you is the correct resource to use. Successful learners use learning strategies, and the most successful learners select different learning strategies based on the situation.

I'm hoping that these micromaterials can add to the wealth of resources online to help people learn about using git, and also start the wider conversation on what other micromaterials could help people develop their tech skills.