Day 2 in Andela Boot camp: Stepping into Git & GitHub
The question was: How do we share code? Many answers came up but one that really stood out was Git and GitHub. Now before I write anything else, I would like to say the difference between these two terms because I initially had not known there was a difference. Git is the Version control system, Version control is also known as Revision Control or Source Control. It lets you track your files over time so that when you mess up, you can go back and get a previous working version, a tool to manage your code history but GitHub is the hosting service for Git Repositories.
We were introduced to Git using the Code School — Try Git tutorials
- I learnt how to use the terminal to do Git operations such as initializing our repository which is a hidden directory where Git operates with git init.
- I also learnt about the git status command which helps me to see what the current state of my project is. It was done with git status.
- To tell Git to start tracking changes made to a particular file I created, I realized I first needed to add it to the staging area by using git add followed by the file name. If this was done, I observed that if I call git status, it will return nothing added to commit but untracked files present (use “git add” to track).
- I also learnt that I can use wildcards if to add many files of the same type. It was done by typing git add ‘*.txt’
- The files listed after committing are in the Staging Area, and they are not in the repository yet. I realized I could add or remove files from the stage before we store them in the repository.
- To store our staged changes we run the commit command with a message in double quotes describing what we’ve changed. We did this by typing git commit -m “”. The message which could be anything in quotes. -m shows we want to add a message.
- If I had wanted to commit many files to the repository, I could use git commit -m “”. The same as committing a single file.
- I could check my history and see what I have changed using git log.
There are many other things we learnt in Git and GitHub of which I can’t document everything here; I hope to start using these tools in collaborating with different people from different parts of the world.