My name is Mason Ellwood, and I’m currently working on Flatiron School’s Online Full Stack Web Development Program. Each week, I’ll be writing about my experience, what I’m learning, and tips on learning to code.
So if you have never used GIT or Github, then get ready for a headache. Or at least it was for me. First, assuming you are all familiar with simple command line operations in your terminal, go ahead and open up your terminal environment.
In this post, I will mainly cover definitions.
GIT Repository Basics
$ mkdir < file folder name > : creates folder
$ cd < file name > : navigates to that folder
$ ls : shows files in set location
(remember don’t type the dollar sign)
So here we go….
Typing $ git init will initialize a new GIT repository in your current directory, by typing $ git init form within your < file folder > project directory. This creates a hidden GIT folder within < file folder > which created a new repository within the GIT folder. This is what GIT uses to keep track of all the versions of your code.
$ touch < file name > : creates new file
$ git status : checks the current status of project/repository
$ git add : adds file to current git repository
If you would like to capture all the changes in a directory, the standard method would be to type < $ git add . >, where the period (.) refers to the entire project.
A commit is like a frozen copy of your code at a given point. Once you have made a commit, you can always revert to that version of your code as it existed at that exact moment. This also must also supply a message describing the version of commit using $ git commit -m “message” where the -m represents a commit message.
The best way to capture all outstanding changes in a commit is with $ git commit -am or -a -m which can be combined as -am. This will add and assign a commit message
With the information provided above, you should be able to see what will be used in the next post. In the next post, I will set up a GIT repository from start to finish. It will show you how to create it locally then connect it to Github. This will allow you to store your code online and it will be accessible anywhere you have an internet connection. Please bare with me, GIT took me a while to grasp and a lot of the shell command you will see in the future post, you just have to flat out memorize. Above are the simplest most well-used GIT commands, and many I use all the time.
Thank you for you time and please comment if this was helpful. The Flatiron School does an awesome job at explaining GIT and GitHub and I am hoping I can provide an overview that is as well readable and applicable.
Leave a Reply