DEV Community

Rachel
Rachel

Posted on

Coding Journey: Getting to grips with Git & GitHub

Until recently I had shied away from using git and gitHub. I had watched a few YouTube videos, decided it was too complicated and mainly left it alone aside from occasionally using the gitHub extension is VS Code with little to no idea what I was actually doing (and often breaking projects!).

The bootcamp that I am currently enrolled on took us back to basics starting with the command line and went through using simple commands such as mkdir, cd and ls. This ended with a command line based murder mystery style task where we had to search through files and folders to find clues to solve a murder!

mkdir [directory name here] - make directory with specified name

cd [directory name] - change in to specified directory

ls - list files in current directory

Enter fullscreen mode Exit fullscreen mode

From there we learnt how to initialise git in a directory, track and commit changes, set up a remote repo and push to gitHub all using the terminal. Using the terminal helped me to think about each step I was taking and what I needed to do next, and also allowed me to figure out where I had gone wrong and fix errors. Previously, I relied too much on the VS Code extension without actually knowing what I was doing.

git init - initialise git in the directory

git status - check the status, what is being tracked etc. I use this ALL the time

git add [filename] - add files to staging area ready to be committed

git add . - adds all files to staging area

git commit -m"message goes here" - commit the staged files, add a meaningful message

git remote -v - checks for remote repo

git remote add origin [remote repo url] - adds specified remote repo. Remote repo will be named origin

git push origin master - Pushes changes to origin, the remote repo, from master branch

Enter fullscreen mode Exit fullscreen mode

With my new found git confidence, I decided to take part in this years Hacktoberfest. It put my git skills to the test as I was forking projects, cloning to my local machine, making changes and making pull requests to the original repo. Now I am feeling a lot more comfortable with git and gitHub and use it on a daily basis with my bootcamp projects.

Top comments (0)