Alexa 101: Git and GitHub
So get ready and buckle up your seat belts, Sorry!! Sometimes Alexa loves cracking jokes. I mean you all might be ready with your PC and stable internet connection.
GitHub — Is a code hosting platform for version control and collaboration. It lets you and others work together on projects from anywhere.
Git — This is a distributed version control system for tracking changes in any set of files, originally designed for coordinating work among programmers cooperating on source code during software development.
Version Control System — Version control, also known as source control, is the practice of tracking and managing changes to software code. Version control systems are software tools that help software teams manage changes to source code over time.
First, we have to visit this Website https://git-scm.com/downloads. And download Git according to your device. And then we have to complete the installation.
Local version control system — Maintains track of files within the local system. This approach is very common and simple. This type is also error-prone which means the chances of accidentally writing to the wrong file is higher.
Centralized Version Control Systems — Centralized version control systems contain just one repository and each user gets their own working copy where all team members are connected online. You need to commit to reflecting your changes in the repository. It is possible for others to see your changes by updating. If the internet connection is lost the changes are not saved before committing.
Distributed Version Control Systems: Distributed version control systems contain multiple repositories. Each user has their own repository and working copy. They commit changes and save the work to their “local repositories” This is because the commit will reflect those changes in their local repository and we need to push them in order to make them visible on the central repository. Similarly, When we update, we do not get other’s changes unless we have first pulled those changes into your repository.
Repository — It is the storage location for software packages and also known as “repo” in short form. A repo can be local or remote.
Local Repository — Repository stored in your local devices.
Remote Repository — Repository stored on your GitHub.
Commit — Using the “git commit” command we can save all the changes on the local repository.
Push — Upload Git commits that you have executed into a remote repository, for example to your GitHub account.
Pull — Download changes from a remote repository, for example, you are working on a project with your friend. He/she “pushed” the latest changes to the GitHub repository you are using for the project. You will need to pull those changes so that your local repository stays up-to-date.
Git Bash: Terminal-command line like platform allowing us to manage changes in our project by using a series of different commands (which will be discussed in the next post).
Let’s Create A Repository!
$ git --version
$ pwd
pwd — pwd command is used to print the “Present working directory”
$ cd
cd — cd command is used for changing the directory.
$ cd ..
cd .. — refers to the directory immediately above the current directory, its parent directory.
$ mkdir <name of the folder/file>
mkdir — make directory allows you to create a new directory/folder.
Initializing Git
$ git init
For using Git, the installation will not be enough. We have to initialize and need to do some configuration. Configuration setting just for once, After that Git, will store and will use it when necessary. To initialize Git in our folder we need to use the following command.
See it's this simple! Now that we initialized, let’s move ahead and do the configurations.
$ git config --global user.name "your_GitHub_username"
$ git config --global user.email "your_GitHub_email"
$ git remote origin <the link that you copied from remote repository>$ git status
$ git add .
$ git commit -m <"Any message">
$ git push origin master
We will let some important Topics continue in the next Blog:
- Going back to older versions,
- Branching & merging,
- Pushing & Pulling changes to our repository,
- Cloning some other Repository.