To really improve your git skills it is essential that you build up a better mental model, a part of that means understanding all the different states a file could be in. Files can be on your computer, a repo, a staging area, your working directory, server directory, or a local stash.
Chris Achard's egghead.io course Fix Common Git Mistakes will demonstrate many of the common mistakes made with git and shows how to fix them.
Taylor Bell: Hey Chris, thanks for joining me today.
Chris Achard: Yeah, thanks for having me.
Taylor Bell: Yeah. So I wanted to ask you a little bit about your new course on Fixing Common Git Mistakes. So what are some of these common mistakes that you've seen?
Chris Achard: Yeah, that can be anything from just typos in commit messages to messing up entire commits or merge conflicts and anything where you're worried that you're going to lose the data that you already have and git, that's what this helps with.
Taylor Bell: Cool. So you talk a little bit about the mental model of git, could you give me like kind of the elevator pitch on building a better mental model?
Chris Achard: Sure. So part of the problem, when I was looking at my own understanding of git, was I didn't understand all the different states that a file could be in. So I kind of start with a file exists on your computer in a repository, git has a staging area and then you have your working directory and then you have the same thing on the server. You have a full repo on the server and then locally you also have this stash area. And so kind of knowing that you can have files in any one of those places with differences helps you because then you can learn about moving those patches, those differences between the different states.
Taylor Bell: Cool. And can you walk me through what journey the learner will take in your course? How do you teach these things about git?
Chris Achard: Yeah. So we go through a very small little sample project and the code is fairly generic. You don't have to necessarily understand the code, but it's more like we start a new project and we just start making some of the mistakes that you may make on normal projects. And so we have a commit that we want to change the message of, and then we have a commit where we want to add more files and then we accidentally push a bad commit. And so we do all these different things that you may do in a real project just on a much smaller scale.
Taylor Bell: Cool. And what kind of next steps would you suggest after somebody takes your course?
Chris Achard: After this, you should have a hopefully much better mental model of git. And you may not memorize all the different ways that you can change things, but you should know, for example, that you can, if you want to go back and change old commits, then you can interactive re-base and do that. And you know how to do that now. And so hopefully it just makes your git usage much more robust in your team or yourself, your own projects.
Taylor Bell: Cool. Well, thanks for joining me today and I look forward to upgrading my git knowledge and I can stop Googling these same three things over and over again.
Chris Achard: That's right. Yeah. Thanks.