Skip to main content

Featured

SQL vs NoSQL.

SQL vs NoSQL.   By  Jeewantha Hiddalarachchi. In this tutorial, I going to discuss the difference between SQL and NoSQL databases. Let's start with a brief explanation about SQL and NoSQL. What is SQL? Structured Query language (SQL) is the standard language to communicate and deal with relational databases.  A relational database is a form of tables. Basically, we use SQL to insert, search, update and delete database records but it helps users to do lots of things like optimizing and maintenance of databases. SQL databases are table-based databases and there are vertically scalable. Not only that but also SQL has a predefined schema and always requires specialized DB hardware for better performance. Examples SQL databases -   MySQL  Microsoft SQL Server Oracle Sybase What is NoSQL? NoSQL is a non-relational Database Management System. And also NoSQL not like SQL because it does not require a fixed schema, avoids joins. It is mainly focused on scaling, fast queries, allowing for fr

Introduction to Git and GitHub (Part 02).

Introduction to Git and GitHub (Part 02).

By Jeewantha Hiddalarachchi.

Step 7 - Check the current branch and create a new branch.

Step 7.1 - Check the current branch.

Branch in git is another copy of the original repository and branch will allow the user to isolate changes without touching the original repository. The first branch of the repository called the master branch.

Users can create a number of branches as users wish and working on them independently until the user wants to merge a branch with another branch.

To check the current branch, use the git branch command.

git branch

* mark indicates the branch which you are currently in.

Step 7.2 - Create a new branch.

If the user wishes to create a new branch, the user should use the git checkout -b <branch_name> command. As an example, I name my new branch as devjeew.

git checkout -b devjeew

-b makes a new branch and checkout moves to the new branch from your current branch or master branch. 


Now You can see all branches, using the git branch command.


Additionally, Now I am going to tell you How to create a repository known as a remote repository in GitHub.

If you want to work with a team, you can use GitHub, GitLab, or other products as I mentioned in the introduction to Git and GitLab (Part 01) blog post. It helps to collaboratively modify the code. In this time, I'm going to tell about How to create a new repository on GitHub.

First, You should log into your GitHub account and the system will redirect to the GitHub home page. Then you can see a plus (+) mark with a down arrow button next to your profile picture in the top right corner. 


After clicking that button, choose the New repository option


Then GitHub asks the name of the repository and some other details. 


If you want to hide your repo from others, select the private option.

When you are done filling, press Create repository button. Then you can see your new repository like this with your new repository HTTPS link and SSH links.

Step 8 - Push to a master and a branch to Github.

Step 8.1 - Push to a Github master branch.

GitHub is asking us if we want to create a new repo from scratch or if we want to add a repo we have created locally. In this case, since we’ve already created a new repo locally, we want to push that onto GitHub so let's follow the ‘….or push an existing repository from the command line section: copy the command from Github.

First, you should check out your master branch, git remote add <remote_repo_URL> command adds a new remote repo to the current branch.

git checkout master
$ git remote add origin https://github.com/JeewHiddala/sample-repo.git

remote gives a clone of the repository, position in another machine.

Note: If you are using Windows as your operating system (OS), use HTTPS link as your URL, or else you're using Linux as your operating system (OS) like ubuntu, use an SSH link.


To push local changes to the remote repository master branch, use the git push origin -u master command.

git push -u origin master

When you copy(clone) a remote repository to your local machine, git creates an alias for you. In nearly all cases this alias is called “origin.”

Step 8.2 - Push a branch to Github.

To push your branch, checkout to your branch and use the git push origin <branch_name> command.

$ git checkout devjeew
$ git push origin devjeew


Use git remote to see the list of your remote repositories.

$ git remote


Use git remote -v to see the list of your remote repositories and their URLs which associate with the current repositories.

$ git remote -v


To see your branches in GitHub, click the Branches button in your repository.


Then you can see your branches, like below

Summary.

We discussed some of the useful commands for branching using git and GitHub. And also get knowledge about how to create a new GitHub Repository and some tips on how to succeed in your coding with git.  Okay, In my next article I hope to give an idea about pull and merge codes and also get changes on GitHub back to your computer. 

Also, you can get all the above git commands from my GitHub gist.

Thank you very much for reading and I hope you have a better idea about this topic...😊.

Comments

Popular Posts