On the third day of Gitmas, my mentee asked of me… Git’s ready – what then?
how do I get Git set up,
and could you explain Git, pretty please?
Yesterday, we got Git installed on your computer. Today’s Day 3, where we’ll be setting up a super simple Git project.
There are different ways to set up a Git project. Today we’re setting up a Git project locally, so you can track your own changes as you work. Tomorrow, we’ll talk about setting up a project using a service such as Github or BitBucket, so other people can work on your project with you.
All you have to do to initialize Git for your project is navigate into the top-level folder of your project in your terminal, and typegit init
And voila – now you have a Git repository!
But… I still have so many questions.
Questions are good! (And if you have any questions I don’t answer, even (especially!) if you think it’s a silly question, please to ask them in the comments below!) This Git series is aimed towards the absolute beginner programmer, so here are a few answers for the questions I can think of:
What’s a terminal?
The terminal is an environment that runs in a program called a console on your computer, that allows you to run commands in the command line.
We discussed which terminal apps you can use in yesterday’s post!
Okay, then what’s the command line?
The command line is the interface that you interact with in the terminal. That’s a fancy way of saying that it’s the place where you can type stuff when you open the program that runs your terminal.
Where should I put my project?
Anywhere you’d like!
Um, that’s not helpful
Technically, you can initialize Git in any folder on your computer.
In practice, however, many devs will have a specific folder that contains all their repositories. Mine’s called repos
, and lives in my home (~/
) directory. Note that you’re not going to want to initialize Git for your entire repos
folder. Rather, you should create a new subfolder for your new project (mkdir project-name
), go into that folder (cd project-name
), and then git init
in there, so only the stuff in your project folder is tracked.
However, depending on your project, sometimes your folder has to be elsewhere (for example, I do a lot of voxel art for my game, Bobber Bop, and those have to go inside a folder within the MagicaVoxel app). That’s 100% okay. You can still navigate into your folder, wherever it is, and initialize Git there.
What does it mean when you say you’re doing something “locally”?
“Local” means something that you can only view on your own computer. If you create an .html
file and open it in your browser, you’re viewing it locally.
On the other hand, “remote” means on some sort of server where you could view it from other computers.
Any other questions? Let me know in the comments!
If you have any questions about Git or requests for other topics you’d like to see me blog about, please leave a comment! And if you’re enjoying this series, consider supporting me on Patreon, following me on Twitter or checking out my Twitch streams!
3 Comments
Pingback: 12 Days of Gitmas: Connecting your local repository to GitHub - SushiCodes
Pingback: 12 Days of Gitmas: .gitignore - SushiCodes
Pingback: 12 Days of Gitmas: Git Branches - SushiCodes