The Basics of GIT

Ian Wright
3 min readSep 23, 2020

--

Working the terminal may not always be fun and games but when it comes to the basics it’s always fun!

Photo by Glenn Carstens-Peters on Unsplash

The very beginning

When working out of GitHub you always want to begin by forking the repo! I can tell you by experience this is what you want to do first! After you’ve selected the fork and select where you’d like to place it, it may take a few seconds to ‘fork’. After you’ve forked, now you want to clone your work and now time for the next step.

Photo by Markus Spiske on Unsplash

Terminal Time

Now the true fun begins of the basics! Load up your trusty terminal, I personally use iTerm2 on mac but enough about me. Once you’re all loaded up it’s time to create magic, in the terminal you’ll want to type ‘git clone <url here>’ and enter. By doing that you telling the computer you want to clone that url into my local drive. Now that’s out the way you can type ls to see what directories have been added. When you find the one you are looking for run cd <directory> to get in it. Once you’re in there you can now type code . and after a few seconds the coding software will pop up with your new project YAY!

Adding your work

While you’re coding you want be pushing your work up as often as you can, you don’t want any unfortunate things happening and lose all the progress you’ve made! To add work we can simply go to the terminal in our code, we can start with the command git add <file> . Doing this you add the file you are working in but that’s not all we want to do. Next we want to commit the changes, we can type git commit, and you will enter the vim. In the vim we can press i to start typing our comments for our commit, you want to give a good description for others to know what’s going on. When you are done we press the esc key and use :wq to quit and save what we did. Last but not least we will use the command git push origin master, this will push all the work and commands you just did to your master branch, pretty cool huh?

Conclusion

Using the basics of git can be very tricky at first, but when you fully understand it becomes so easy and useful. It will make coding life much simpler and less stress. Thank you all for reading!!

Photo by Caspar Camille Rubin on Unsplash

--

--

Ian Wright
Ian Wright

No responses yet