Before I could proceed any further I needed to set up an account. I wasn’t exactly sure what it was, what it was doing, what it was showing me, or even what it was showing me that I was doing. All I knew was that it was called GitHub, so I just rolled with it. After weeks of boot camp preparation, it was Day 1 at Flatiron School and we were learning about this Git/GitHub thing. Our instructor was teaching us about contributions and showed us this quaint little grid that had multiple shades of green.
Imagine my surprise when I realized that I had been personally adding to this. Every time I finished a readme or a lab, I was generating a commit? Neat-o! (thinking, what kind of picture can I create with diligent commit contributions, haha)
It is now Phase 3 of boot camp, the workload has piled up and it’s been a heck of a roller-coaster. It’s only going to get more intense and right now the only thing I can do to prove to myself that I really care about this is develop the habit of making commits to my GitHub and showing that commitment and consistency. It’s really about organization. Files have been misplaced and thought forgotten. It’s time to get it together!
What is a “Git”?
Git, is a type of distributed Version Control System. It is what can track the changes you make in any given file. It is considered distributed because it allows you to easily work on your local computer or laptop while collaborating with other developers and contributors for a project. And the best part is, those contributors do not even have to be on the same network to pass changes back and forth. Wouldn’t that just be tedious and annoying after a while? Git can save any change you make in a local file, and give you the ability to go push that file to a remote location and still go back to an earlier version of it, in case a new change that had already been saved was a mistake. But here’s the catch, your changes must have been committed for you to be able to revert to an earlier file version. See where I’m going with this? Let’s continue.
Ok, then what is GitHub?
GitHub is the cloud service that hosts all those files that are being changed and pushed to folder locations called Repositories. In a GitHub repo, you can track any and all committed changes made to a file to build a well developed history.
Git is to GitHub like Word is to OneDrive... but a bit more complicated.
Into Git Bash
Git Bash is an application for Microsoft Windows environments, like my local laptop, which gives a simple execution of a Git command line. Bash stands for Bourne Again Shell, and a shell is a terminal application used to interface with an operating system through written commands.
My repo was in shambles! Files that I didn’t use were in my face and I just sat there. It’s about time I organize these documents and start comitting to those commits!
I want to condense my files so they look a little more put together and concise. It will not only be easier to read but also prettier to see.
Check the status of your repo. What’s going on? What kind of activity has recently taken place?
git add .
The period at the end implies you want to select all of your files. So git add . adds all local activity changes to the remote repo. That way, you don’t have to type out each file name. However, ideally, if my repo was properly documented, I would add changes on a file to file basis to deepen those green commits.
git status (again)
Check to see if the changes were successfully applied to the remote repo.
git commit . -m “ ”
Commit the changes to the remote repo so it can be tracked… for the rest of history (so long as it is maintained). When contributing, it is always best practice to leave a message about what has been changed and contributed using git commit . -m “ <file name>”.
Push the contributions up to the repo and make sure they are there by checking the repository. This check can also be done using git status, as we know.
Now just keep doing this… forever.
HUH? Forever?? Why?
Well, maybe not forever, but so long as you are in the developer world, your GitHub repo will always be a point of discussion. There are many reasons why making consistent commits and contributions to your GitHub repo is so important. But here are a few of my motivators:
- Accountability: You can keep all accounts of your work. Both past and current (but not future).
- Consistency: Displaying that you worked on something technical and made a contribution everyday shows good dedication and consistency. The visual representation of your commits can also help possible employers decide when to hire you or not based on your literal physical work ethic.
3. Contribution Graphs are so cool!: just look at these commitment masterpieces!
See why making contributed commits are so important? But they are also pretty cool looking, so that’s a bonus!
There was a struggle…
…But We Love Solutions
I couldn’t get my files to add to my repository. I kept getting this very unproductive error that I couldn’t figure out. It’s funny how I can be on Google all day and still forget that it exists. If you, dear reader, happen run into an issue where you might have an error like the one shown below, it could mean you have more than one git command being executed at the same time.
rm.git/index.lock released the file lock and solved the issue. Then reuse git add . , at a second attempt at to add the files to their respective, remote locations.
Get the status once more, even though we know it worked due to the previous running process.