Skip to main content

Getting Started with Git & GittHub


Creating a Git Project

Git is a version control system that keeps track of the files in a project. In order to use git, we start by identifying a folder as a git repository. we do it by running init command in the folder. Before running the git command go to your project folder and create two files called file1.txt and file2.txt and add some sample text to it and save the file. Now open up the git command line in the project folder and type the following command. An easy way to is by right clicking anywhere inside your project folder and click git bash here.

$ git init


Checking Status


Now we created a git repository. Now we can check the status of our repository by typing git status in the git terminal.

$ git status



You can see there are two files in red which called as untracked files. This is because we still didn't add any file to our git repository.

Adding files to Git repository


To add files to your git repository by simply typing git add file1.txt. This will add file1.txt to git repository.

$ git add file1.txt

If you want to add multiple files you can type

$ git add file1.txt file2.txt

But if you want to all the files to in the to your git repository, you can do by simply typing the following command. This will add all the files to your git repository.

$ git add .

Now, if check the status git status we will see the output like this.



Now we can the file1.txt and file2.txt in green colour which means git it now start tracking our files. So now the all the changes we do our file will keep a track.

Committing files


Committing means like we are telling git to keep a checkpoint of our current working file. We something goes wrong in the future we always can come to the stage where we were. Also, this commits helps develops see what files are changed and what modifications are done through the project. You can commit using the following command.

$ git commit -m "Commit Message"


Adding project to GitHub


Git hub is a place that keeps and manage your repositories. It helps manage a project with other developers with a very simple and easy manner. So now let's add our project to GitHub. First of all, you need to have a GitHub account with is easy and create and Free. Go to https://github.com and create your account. After creating your account create a repository.



Now type the following command in the git terminal. This will allow git add files to Git Hub remote repository. You will ask to enter your GitHub username and password.




Now if you refresh the GitHub page you will be able to see your files.



Comments

Popular posts from this blog

Introduction to MEAN Stack

MEAN stands for Mongo, Express, Angular and Node. In the world of modern software, we typically deal with frontend and backend. MEAN Stack includes both technologies for both sides frontend and backend. Mongo Mongo is a cross-platform document-oriented database. Meaning is not like more traditional SQL database. Which is where NoSQL term comes from, with that means Mongo DB Store JSON-like documents with dynamic schemas making it better and faster for some applications.Companies with large scale deployments of Mongo DB includes Adobe, eBay, LinkedIn and much more. There is no database we can call as the best. It depends on the type of the system. Mongo DB is one in many options. Mongo DB is good for developers who is familiar with JavaScript and JSON and also easy to start learning. Express Express or ExpresJS is Node JS web application framework. It's the server framework for NodeJS. It allows quick development of robust web APIs by providing the thin and performa

Unit Testing with Mocha

Unit testing is the best way to uncover hidden bugs in your system. JavaScript Community has produced several testing frameworks that will help us with the task of writing Unit Tests. Some of them are Jasmin, Mocha, Jaster, Quint. These are all JavaScript Testing frameworks, that you can use to test JavaScript Code. Today we are going to focus on the Mocha testing framework. Let's go and install Mocha globally that we can use on any of our projects. $ npm install  -g mocha To run a Mocha test all you need is to type mocha. But you need to have directory named test. Before running mocha first make sure you have created a directory call test. $ mocha Now Mocha is ready to use. Now let's go and create our first test. Create a folder MochaTesting anywhere in your folder. This is the folder we are going to work. Inside that folder create a folder called test. Inside the test, folder create a file call my-test.js We are going to use Test Driven Development. That mean