This will be my third blog about GitHub and each time I covered this topic I learned more each time. This time around I finally understood git from the terminal. Tutorials I were following was from instructors using Macs so I never was targeting the right file.
So first of all if you are a windows user or a linux user in order for you get into your C drive you have to use this command.
Once you are in your C drive (where I’d recommend putting your projects in) use command ls to see if you can target projects folder. If you see it in your list just use the command cd projects.
Once you target the project folder just target your project within your project folder by using cd project-name.
Then from there in order for you to initialize git you have to use command git init. Once you use this command in the right file git will then track this file for any changes.
However just because git is tracking your files it is not automatically added into your GitHub account. Your new changes will be in what is called an unstaged area.
In order for you to add your new changes to the staging area for you to add it to your GitHub account online you need to use command git add .
Once you have added your file into the staging area you are one step area from adding it to your repository. All that is left to do is to commit the code. git commit -am”I changed xyz” is the common command to commit code. Committing code adds it to the repository.
Those are the basics to adding code to a Git repo however here are some useful command
This information is even more useful knowing that companies use Git professionally to work as a team. However, what tools do companies use while using Git is the question.
Today I excitedly learned about Bitbucket and Sourcetree the tools used by the professionals. Bitbucket is better than Github if you are working for a client or for a company since your code will not be public. Sourcetree is a visual representation of using Git which makes it a lot easier to work with branches. Branches are important because in a professional setting you will never be working on the master branch directly because you don’t want to break the code.