What are gitHub, gitLab and bitBucket? How does gitHub work?

gitHub, gitLab and bitBucket are some of the most popular web-based hosting services in our Git repository. They have a web-based graphical interface with all the benefits of the git tool and clients for desktop and mobile. Simply put, services like gitHub, GitLab, and bitBucket are a great place to share your code with friends, colleagues, classmates, and even complete strangers. This does not mean that if you use these hosting services, others will know everything about you. Such a public repository can be opened here. In the same way, if you want to protect the privacy of your code, you can open a private (unlimited or limited number of free) repository. Many open-source projects continue to work with their huge community using these hosting services (gitHub, GitLab, and bitBucket). They do not require an account for anyone to read the public repository’s code, and the entire repository can be cloned to one’s own PC with the click of a mouse. You usually need an account to open a repository in these then you can open public or (unlimited or limited number of free for a small amount of money) private repository. You can put code of many projects in these hosting services. You can put the code of one of your projects in a repository. One of the advantages of these hosting services is that the code you type in them can be seen by anyone around the world. Anyone can develop the source code of your application. Since it is an online storage system, you can access it from anywhere and commit to change the code.

Connecting the Git Repository to gitHub:

Now we will connect our Git Repository to one of our GitHub accounts. And for this, you must first have an account on GitHub. Hopefully, you can do this job on your own very easily.

Once the account is created, you need to login to your GitHub account. After login, you will see a plus sign on the top right. Clicking there will open a menu where you will see the text New Repository. Clicking here will take you to the page to create a new repo.

Then first give the owner and name of your repository here. Remember that repository names should be unique and URL friendly. And since the description field is optional, you can give something if you want and you can leave it blank. But it is better to write about repositories in detail than to leave them blank. In the next field, select whether you want to make it a public repository or a private one. However, if you have a free account, you will only have access to the public repository. Now leave the rest of the fields as they are and click on the Create repository button.

Now with the click of the Create Repository button, a new repository will be created in your GitHub.

Now we will see how to connect to our already created Git repository with our created GitHub or push Repository there.

Push on GitHub:

We have to be sure of a few things before pushing to GitHub. That means you have to make sure you have everything committed. Also, need to check if you are in the master branch? You can easily check it with the git status command.

If all goes well, now you need to clone the new repository created in your GitHub as below.

Once cloned, you need to add remote origin in this way

git remote add origin https://github.com/username/git-learn.git

This will basically set the location of the project created in your GitHub. And you only have to add it to your project once, no more pushing next time. That means he will remember from next time. Then you just have to push. Now if you want to push the project, you have to give the following push command:

git push origin master

Or if you want to push a specific branch, you have to give the name of the branch in place of master. For example, the push command for our showTable branch will be as follows:

git push origin showTable

If all goes well, your project will go to GitHub. However, you may need to enter your GitHub username and password here. In this case, you can set up the SSH key for your machine if you want without repeatedly giving the username password while pushing in this way, and if you use SSH, you don’t have to give username and password anymore. If you want to set up SSH, you can take the guide from here.

Pull from GitHub

You may have to pull the project from GitHub for many reasons, many times you do not have the project on your local PC, but previously pushed to gitHub. Again, maybe another collaborator or a team member in your project has pushed it to do something new in your project. Now automatically but that work update will not come from GitHub to your local machine. That’s why you have to pull it from GitHub like this:

git pull origin master

Before you pool, you must see if you have any work left to commit. If so, you have to commit it first. Other than that there may be conflict when pulling a lot of time. This means that many times when two collaborators edit the same file, Git merges those tasks as automatically as possible, much like merging branches. And if there is a conflict, Git highlights the codes of that line with some special writing everywhere. Then we have to go to those places manually and decide which line to put and which line to leave out and then we have to commit the changes again.

Project cloning from GitHub

A lot of the time anyone who is on GitHub has to sit on our local machine to work on any project. Then we have to download a clone copy of that project to our local PC. If you want, you can clone any public project of GitHub like this. For this, first you have to find the link of the clone of the project you will clone. And the cloning link you can go to any project page of GitHub in the top right corner of the project file listing in the button called Clone or download.

However, if you want, you can download the zip file from here. However, the current branch of the GP contains only the files. Git has no configuration. Clone with the command line in git like this:

git clone

Here you first need a git clone then a link to the GitHub repository. You can then enter the name of the directory in which you want to place the project on your local machine. It is optional to give the name of the local directory, otherwise the name of the default repository will be cloned in the directory of that name. Suppose, we will clone this project opensourcepos. So I will open the command line and write the following command:

git clone https://github.com/opensourcepos/opensourcepos.git

Now if you enter, the project will be slowly cloned to your local machine. Now if you want you can go inside it and use Git while working, you can modify the project locally, you can do everything. And this projector remote will be set automatically from where you cloned. If you are not the Collaborator of this project, you will not be able to push remotely, and if you are the Collaborator, you will be able to push this project, any new commitments you have made.

Creating Pull REQUEST on someone else’s project

Suppose you want to contribute to someone else’s project. Fork is a lot like a clone. The difference is that cloning is like downloading a copy to your local machine. But if you fork, the copy will be created in your GitHub account without downloading to the local machine. You can use that copy as your repository. You can also clone that forked repository and bring it down to the local machine. This fork button is located in the top right corner of GitHub’s desired project page.

After being forked, you can now clone from your account and work on it.

PHP Basic Part-1: What is PHP (What is PHP)?

PHP is a server-side scripting language developed by Rasmus Lardorf in 1994. Which is specifically used to create any dynamic and interactive web development or web based software and web based applications. It is now also called General Purpose Programming Language. That is, everything that can be done with other programming languages ​​can be done with PHP. Also PHP is more popular with web programmers as it is open source. However, it is most commonly used for web development, web-based software and web-based applications. PHP also provides maximum security when storing information on the web. PHP can be used in conjunction with HTML. There are many advanced open source content management systems developed using PHP, Ex: WordPress, Joomla are created by PHP. Custom content management systems can be created using PHP. PHP is also widely used in e-commerce, management, online banking software, etc. PHP is a very popular language, according to w3techs, 82% of the world’s web sites use PHP in server side scripting. Currently 90% of freelancers in Bangladesh (i.e. those who work from home and abroad) work through PhP language.

What do I need to know before start learning PHP?

What are the things you need to know about computer programming before learning PHP? What is the web? What is the Internet? There should be ideas on databases, and MySQL etc. Without it, if you know HTML, CSS, you will enjoy learning PHP.

What kind of computer do you need to learn PHP? Which software needs to be installed?

The latest operating systems such as windows-7, windows-8, windows-10 or those that work on Linux, such as: ubuntu-15, ubuntu-16, ubuntu-7 should be a computer that supports any.

What other type of software do you need to install:

  1. Server software such as: XAMPP, WAMP, EasyPHP etc. All of these softwares are free and open source. And these softwares are basically the sum of everything you need for a web development environment setup.
  2. Code writing software such as: SublimeText, VS Code, Notepad ++, NetBeans, Aptana, Eclipse etc. All of these softwares are free and open source.
  3. And any browser to see the output, such as: Mozilla Firefox, Google Chrome, Opera, safari, etc. Those who use Windows OS can continue working with the Edge browser.

What is Laravel Framework?

What is PHP Laravel Framework? To understand that we first need to know what is PHP? And what is the framework?

What is PHP?

PHP is a server-side scripting language developed by Rasmus Lardorf in 1994. Which is specifically used to create any dynamic and interactive web development or web-based software and web-based applications. It is now also called General Purpose Programming Language. That is, everything that can be done with other programming languages ​​can be done with PHP. Also, PHP is more popular with web programmers as it is open source. However, it is most commonly used for web development, web-based software, and web-based applications. PHP also provides maximum security when storing information on the web. PHP can be used in conjunction with HTML. Several advanced open source content management systems (CMS) including WordPress, Joomla are created by PHP. Custom content management systems can be created using PHP. PHP is also widely used in e-commerce, management, online banking software, etc. PHP is a very popular language, according to w3techs, 82% of the world’s web sites use PHP in server-side scripting. To work with the PHP Framework you need to have a very good idea about PHP Object-Oriented Programming.

What is the framework?

Suppose you are a building construction engineer and you are allowed to build a building. You are now given two options:

First, you are given a plot, the architectural design of the building, and all the money you need to build the building and are asked to build a building. But you are not given any of the building materials like bricks, sand, cement, rods, mixers, labor, and all the other equipment, all of which you have to collect or make and use for building work.

And secondly, you are given the plot of the building, the architectural design of the building, building materials such as bricks, sand, cement, rods, mixers, labor, and all the other tools, now you just have to use them to build the building. Which would be a better option for you as an engineer?

Undoubtedly the second. Although it is possible to work with the first one, the biggest problem is that you will need a lot more time here. Which will increase both the time and cost of constructing the building?

In this case, the second option is better. Because everything is already ready here and it will greatly reduce both the time and cost of building your building.

The framework is similar to our second option, where everything is ready for web development, application development, and software development and you just need to know how to use it. This will greatly reduce the time and cost of your web development, application development, and software development. In other words, the framework is a collection of readymade classes and interfaces through which we can do different types of web development, application development, and software development very easily and in less time.

What is PHP Laravel Framework?

We know about PHP and Framework, let’s know what is Laravel? Laravel is currently the most powerful and popular PHP Framework. It is an Opensource Secure PHP MVC Web Framework designed for developers who need a simple and elegant toolkit that can build full-featured web applications. It quickly became popular among various PHP web programmers around the world for its outstanding features. In 2011, Taylor Otwel developed the first Laravel. Currently running version 5.5 of laravel.

What are the things to know before learning PHP Laravel Framework?

Before you start learning PHP Laravel Framework, you must know the following:

  • PHP
  • Object-Oriented Concepts and
  • Clear idea about MVC structure.

Composers must be installed to manage the dependency of the Laravel Framework.

Thank you so much for reading the article, if you like the article please comment and share it with your friends.

What is Web Design and Web Development?

Web Design means what we see on websites, determining what a website will look like or what it will look like in general. As a web designer, your job is to create a complete web site template. For example, what will be its layout? Inside the header section, where the menu will be, whether there will be a sidebar, how to display the images, etc. In other words, it is the job of the web designer to determine how the information will be displayed, regardless of what the website information will be and where it will be stored. And to determine this design you have to use some tools like PHOTOSHOP, GIMP, etc. and some markup and scripting languages like HTML, CSS, and JavaScript, etc. We can also call web designers’ front-end developers.

And web development is the lifeblood of a web site.

Web Development is the process of making every piece of design that a web designer makes functional and dynamic.

A web site can be divided into three parts such as design or template, content management system and database.

A web developer combines these three things to make the whole system active and dynamic.

The job of a web developer is to process data, control the database, build security, control the user and admin capabilities, make all the features of the application functional and dynamic, and control the functionality and usability of the entire system.

If you want to be a good web developer you need to have detailed knowledge about PHP, MySQL as well as HTML, CSS, JAVASCRIPT, JQUERY, Bootstrap.

What will you learn? Design? Or development?

In a word, if you are creative, if your choices are more beautiful than a thousand people, then you can do well in web designing. Otherwise it is better not to go that way. Because it takes one designer as opposed to one hundred developers in the market. This means that there is a lot of competition in the designing sector. On the other hand, to be a web developer, you don’t have to be so creative.

What are the qualifications of a web developer?

  • Personal skills are more important if you want to work as a web developer. In many cases, appointments are made on the basis of personal skills, even if they do not have educational qualifications. However, if you want to work as a web developer, the qualification is institutional, but usually someone with a bachelor’s degree in computer engineering is hired. In some cases you may be hired even if you have a diploma degree in computer engineering. In most cases, degrees in information technology or IT, computer engineering, telecommunication engineering are mentioned. In addition, in most cases, the degree mentioned in the recruitment circular is relaxed for recruitment based on old experience and thorough ideas and knowledge. In many cases, you will be hired based on your coding and programming concept, not just a specific subject but a bachelor’s or master’s degree. In this case, the subject is completely institutional and even if you do not have a degree in computer engineering, you can get a job. While most do not require a degree, in some cases a master’s degree in computer engineering may be mentioned.
  • Experience is important when working as a web developer. Minimum 1 year experience for recruitment is compulsory in most cases. In some cases 4 to 6 years of experience may be required. Usually, if you have 1 to 3 years of experience, you can be hired as a web developer
  • If you want to work as a web developer, the recruitment of female or male candidates is usually mentioned separately and there is no such obligation. Since both men and women carry the same burden of work and money, both men and women can work as web developers without any predominance.

Suppose I learned it well. Where and how to work later?

Online marketplaces such as upwork.com, freelancer.com, fiverr.com web page designers and web developers are in great demand. In these markets you can earn a minimum of ২ 2 to ১০ 100 per hour. Apart from that, you can earn lakhs of rupees every month by selling your web applications in marketplaces like themeforest.net, codecanyon.net. And you can work for thousands of software and web development companies in Bangladesh. The big advantage in this sector is that you can get a good salary job in software companies without having to read and write in computer science.

Everything About Git Part: 6

What is Branching and Merging at Git?

To understand what branching and merging in Git is, let me give you a real work experience: When we go to create a simple web site. It is often seen that a few developers have to work together as a team on a web site. Maybe someone in the team works with the home page. Another may work with about pages. It can be seen that one of the developers of the team works on one feature after another. And from this came the idea of ​​Branch. That is, one person works in one branch. Again, when the work of one feature is complete, everything has to be added to the original project again. And it is called Merge. When two developers are in two branches, no one sees anyone’s code. And after finishing the work, the two branches can be merged into one branch.

Creating a new branch:

We will now create a new branch called showTable, for which you need to type the following command:

git branch showTable

Now a branch named showTable will be created. The branch from which you created this new branch will have that version in the new branch. Since we have created showTable branch from master branch here. And so showTable will go to the version of the project that we currently have in the master branch. This means that now the project of master and showTable is the same.

With the following command you can see the list of all the branches in your project:

git branch

Branch checkout

The brunch is ready, now we will checkout the brunch. Usually you can see which branch you are in by looking at the current working directory on your command line. Since we are still in the master branch in our project. And checking out the branch is a lot like checking out the committee. The difference is that before committing commit was required to commit commit ID, now we can check-out with the name of the branch. You need to use the following command to check out the branch.

git checkout showTable

However, if you want to create a new branch and check-out at that branch immediately, you need to enter the following command:

git checkout -b showTableNew

Now we will modify something in showTable and then merge it with master. And for this we have to go to our showTable branch with checkout showTable. Before that you have to take care of which branch you are in. For this you can see on the right side of the current working directory which branch you are in.

Branch modification

Now we will make some modifications in our showTable branch. Currently our project’s test.php file is in this state:

<?php
$newStudents=["Safan","Shail","Tortoiz"];
echo "Hello This is my First Git Learn";
?>
Now we will display that newStudents variable in the form of a table as below.
<?php
$newStudents=["Safan","Shail","Tortoiz"];
echo "Hello This is my First Git Learn";
?>
<table border="1" width="200" cellpadding="5" cellspacing="0">

Students Name

<?php
foreach($newStudents as $student){
echo "

$student

";

}
?>

Now I want to take this modified branch to my master branch or main project. But before that you have to commit these changes to the current branch i.e. showTable branch. Because as long as you don’t commit anything, Git won’t count them. So let’s commit:
git add –all
git commit -m “Tabulized Version Added”
Commit’s work is over. Now I will take the work in this showTable branch to the main master branch. That’s why you need to check-out at the master branch first
git checkout master
Now after checking out the master, you will see that the master is in the previous version. Now we will merge the modifications made in showTable with master branch. And for this, if you give this command while you are in the master branch, it will be merged automatically
git merge showTable

Show the difference between multiple committees

In Git, if you want, you can see the difference between one of your committees and any other committee, that is, the code of your previous committee has changed, where the code has been added, where it has been deleted, you can see all these with the help of the following Git command:

git commit compareFromId compareAgainstID

What is ZCPE?

Zend Certified PHP Engineering (ZCPE) is a vendor exam conducted by California based American company – Zend Technologies Limited. The company specializes in the development of PHP, the world’s most popular web development programming language, and the development of various software developments. As they do, companies like Microsoft, Oracle, Adobe and Google.
Zend Technologies Limited’s main goal is to help millions of PHP web developers around the world through Zend Certified PHP Engineering (ZCPE) courses find their internationally recognized heads and good jobs in the PHP industry through training and certification. For all PHP developers worldwide who can obtain Zend Certified PHP Engineering (ZCPE) Certificate, Zend Technologies Ltd. provides details in the form of a list of all ZCPE Certified in a section called Yellow Pages on the company’s own website www.zend.com. Also, Zend Certified PHP engineers can use the ZCPE logo everywhere, including their personal web site, resume, business card and email signature.

What are the benefits of Zend Certified PHP Engineering (ZCPE)?

1. A Zend Certified PHP Engineer (ZCPE) is preferred over a typical PHP programmer when it comes to job application selection.

2. If you are a freelancer, upwork.com will put you under a special group, so that you can compete to get high value jobs.

3. In general, a true Zend Certified PHP Engineer (ZCPE) earns twice to three times the salary of a typical PHP programmer.

Who will be able to participate in this course?

This course is designed for professional PHP programmers and professionals who have experience with at least 1 PHP based project development and who want to know about PHP Advances from the beginning.

What is taught in ZCE course?

This course gives a programmer in PHP a solid foundation on PHP Language, in this course you are taught many examples hand-to-hand to learn PHP Advance from Basic. In the course, about 600 questions are taken in 10 sections of ZCPE exam, and at the end of the exam, the teacher explains what will be the answer to any of the questions and why. As a result, a student can easily adapt to the Zend Certified PHP Engineering (ZCPE) vendor exam.

 

Everything About Git Part: 5

What is Branching and Merging at Git?

To understand what branching and merging in Git is, let me give you a real work experience: When we go to create a simple web site. It is often seen that a few developers have to work together as a team on a web site. Maybe someone in the team works with the home page. Another may work with about pages. It can be seen that one of the developers of the team works on one feature after another. And from this came the idea of ​​Branch. That is, one person works in one branch. Again, when the work of a feature is complete, everything has to be added to the original project again. And it is called Merge. When two developers are in two branches, no one sees anyone’s code. And after finishing the work, the two branches can be merged into one branch.

Creating a new branch:

We will now create a new branch called showTable, for which you need to type the following command:

1
git branch showTable

Now a branch named showTable will be created. The branch from which you created this new branch will have that version in the new branch. Since we have created showTable branch from master branch here. And so showTable will go to the version of the project that we currently have in the master branch. This means that now the project of master and showTable is the same.

With the following command you can see the list of all the branches in your project:

1
git branch

Branch checkout:

The brunch is ready, now we will checkout the brunch. Usually you can see which branch you are in by looking at the current working directory on your command line. Since we are still in the master branch in our project. And checking out the branch is a lot like checking out the committee. The difference is that before committing commit, we used to use commit ID, now we can check-out with the name of the branch. You need to use the following command to checkout the branch.

1
git checkout showTable

However, if you want to create a new branch and check-out at that branch immediately, you need to enter the following command:

1
git checkout -b showTableNew

Notice that we have created a new branch called showTableNew and immediately checked-out in that branch.

Now we will modify something in showTable and then merge it with master. And for this we have to go to our showTable branch with checkout showTable. Before that you have to take care of which branch you are in. For this you can see on the right side of the current working directory which branch you are in.

Branch modification

Now we will make some modifications in our showTable branch. Currently, the test.php file of our project is in this state:

<?php
$newStudents=["Safan","Shail","Tortoiz"];
echo "Hello This is my First Git Learn";
?>
Now we will display that newStudents variable in the form of a table as below.
<?php
$newStudents=["Safan","Shail","Tortoiz"];
echo "Hello This is my First Git Learn";
?>
<table border="1" width="200" cellpadding="5" cellspacing="0">
    

        

Students Name

    

    <?php
    foreach($newStudents as $student){
        echo "

$student

";

    }
    ?>

Now I want to take this modified branch to my master branch or main project. But before that you have to commit these changes to the current branch i.e. showTable branch. Because as long as you don’t commit anything, Git won’t count them. So let’s commit:
1
2
git add --all
git commit -m "Tabulized Version Added"

Commit’s work is over. Now I will take the work in this showTable branch to the main master branch. That’s why you need to check-out at the master branch first

1
git checkout master

Now after checking out the master, you will see that the master is in the previous version. Now we will merge the modifications made in showTable with master branch. And for this, if you give this command while you are in the master branch, it will be merged automatically

1
git merge showTable

Everything About Git Part: 4

Returning to the old version:

When we are in development, it is often seen that we have to go back to the previous version. After developing the features one by one, there came a time when there was a problem that used to work properly in an earlier version but now it is not working. In that case, if you have tracked in Git, you can easily go back to that version of yours and check the code, if you want, you can also run your project. You will see your project as it was at that time.

We will now intentionally create a new variable called $newStudents inside the test.php file and commit another. After adding a new variable, the file will look like this:

1
2
3
4
5
<?php
$students=["Safan","Shail","Tortoiz"];
$newStudents=["Fuad","Rezaul","Rakib"]
echo "Hello This is my First Git Learn";
?>

Now I will save it, add it to the staging and commit it

1
git add test.php
1
git commit -m "Another New Variable $newStudents Added"

Now we want to make a commitment by dropping that students variable.

Now for some reason, you need to go back to the previous version, that is, you want to return the $ stu1dents variable. And for this, we have to check the log first. Let’s first check the log:

1
git log

Now you can see the logs as below

As you can see in the picture above, there are four committees in total. With the details, you can easily understand what was done in any committee by looking at the message of the committee. And with some encrypted unique commit ID. If you want, you can use them and go back to the previous versions.

However, there is a little complexity, and that is that the unique Id of each commit is much longer. Now if you want to make these IDs easier and shorter then you have to type the following command.

1
git log --oneline

Here are all the essentials that are nice and small. Now the shortcut unique commit ids here have also been shortened. Now we can use these short versions to go back to the previous desired version.

Suppose we want to return to ff15a04 this commit. Now your command to go back will be as follows:

1
git checkout ff15a04

The last one here is Commit ID. Remember your ID will be different here. Now if you run this command, your project will return to the previous version of this commit from the master branch. But of course, you have to keep track of everything while in the master branch. You cannot check-out if a file/folder is un-tracked or uncommitted. Now you will see the commit id instead of master in the command line. See also HEAD detached at your Commit ID.

Now check your test.php file and come back to the previous version. Since you now have an earlier version in your current working directory. But if you want to go back to the master branch, then you have to check-out again like this:

1
git checkout master

Everything About Git Part: 3

New Git Repository Setup:

Basically, the directory is called Repoitory or ‘Repo’ for short. Now if you want to start Git on any of your projects, first you have to go to the project directory from your Git Bash or your CMD command line. Or if you right click inside your project, you will see an option called Git Bash Here. This will open the git bash with the path of this directory by clicking from inside your desired project directory and you can now type any git command for the directory.

Now suppose you have a directory called git-learn in C: xampp htdocs. And there are some files inside. Now here if you want to start Git. Then you have to type the following command.

git init

Now since we want to track everything inside the git-learn directory, so I run the git init command from inside the git-learn directory. And that’s where Git’s repo setup became inside this directory. Now Git can start tracking all of your repo or directories, all the files or folders inside this directory. However, even if tracked, Git will not store them as versions. For that you have to specifically tell which one exactly when and how to save.

Save a specific file of repository or all files as git version:

Before saving a specific file or repository of repository as git version you first need to understand how git works?

When we make changes to the local repository while working on Git, we are in the working directory. And then after giving the git add command, it goes to the staging area and after giving the git commit command, it is permanently added to the local repository. If you want later, it can be uploaded to the remote (GitHub, gitLab, bitbucket) repository with git push command. Notice the image below:

Check the current status of the git

We now want to see the current status of our Git, i.e. which files are not tracked or which files are in staging. That is why we will use the following command:

1
git status

Notice that I have two files in this directory named test.php and index.php. Since I just initiated Git in this project, both files are un-tracked here. And also gives some hints on how to track the files.

Taking File Staging Area

Suppose we first want to track our test.php file, that is, we want to take the test.php file to the staging area. That is why we have to give the following command:

1
git add test.php

The track.php that I have tracked shows it in the Changes to be committed section. And below is the previous un-tracked file. However, at the moment we have the test.php file in the staging area, so if you commit now, Git will only keep this file in the version history. And index.php file that has not been tracked will not do anything about it. Now if we want to give a command to track all the un-tracked files inside this directory then the git command will be as follows:

1
git add --all

or

1
git add .

Now if you give the git status command, you will see that all the tracks are done, which means they are all in the staging area. No files un-tracked. The previous test.php is still in the staging, since we haven’t committed it yet. Now with index.php file and moving to staging area. If you commit now, Git will keep a complete version of the two together.

commit:

commit means final. That means you will make the final decision whether to keep your tracked changes in Git Repo? If you think Git Repo will do, you have to commit. And if you want to commit, you have to give a message with each commit so that you can understand at any time later on which committee was done for what reason. Everything will be in one line like this:

1
git commit -m "New Message Added"

Here New Message Added is the message of our committee.

Note: You cannot commit any file or directory before taking it to the staging area.

Modify the file and re-committed

Now we have a version. But we have a lot more work to do on the project. Now I will add some new variables to the test.php file. The file is currently in the same condition as the new variable and its values

1
2
3
4
<?php
$students=["Safan","Shail","Tortoiz"];
echo "Hello This is my First Git Learn";
?>

Now if you save the test.php file and check the git status, you will see that the file shows it in a modified and un-tracked state.

Now I want to take this un-track file on stage and make a final comment

1
git add --all

And for the Final Commit:

1
git commit -m "New Variable $students Added"

Everything About Git Part: 2

Git Installation and Configuration on Computer

In order to start working with Git, you need to make your computer suitable for using Git. That’s why you need to install Git on your computer. Let’s take a look at how to install and configure Git on different OS.

Windows:

1. Click here to download the Git package.
2. Click on the downloaded file to install it.

Mac OS X:

1. Click here to download the Git package for Mac OS X.
2. Click on the downloaded file to install it.

Linux:

There are different ways to install Git for different Linux distros. But very simple. Enter the following commands in the terminal according to the distro.

  • Debian/Ubuntu
    1
    # apt-get install git
  • Fedora
    1
    # yum install git
  • Gentoo
    1
    # emerge --ask --verbose dev-vcs/git
  • Arch Linux
    1
    # pacman -S git
  • FreeBSD
    1
    2
    $ cd /usr/ports/devel/git
    $make install
  • Solaris 11 Express
    1
    $ pkg install developer/versioning/git
  • OpenBSD
    1
    $ pkg_add git

Git Configure

I assume you have Git installed on any of the above OS. Now you need to configure Git. And the main purpose of this configuration is that when you commit through Git, he will store your information with Comit. All you have to do is enter your username and email address during the configuration. After Windows users install Git, a shortcut file named gitBash will be created on the computer desktop. You can open it and write the following commands in it. Or you can run the commands directly on the CMD if you want. Linux and Mac OSX users can type commands in the terminal.

1
git config --global user.name "Your Name Here"

Enter your name in place of Your Name Here.

1
git config --global user.email "your_email@youremail.com"

Enter your Email Address in place of your_email@youremail.com.

Make sure that the email address you enter here matches the email address of your server account. Now your computer is ready to use Git. From now on you can use Git commands on your computer. We will write all our commands in gitBash, CMD or terminal.

Configure different git for different projects

Suppose you want to have multiple names and emails for multiple projects. That means you have an office project on your PC and you have a personal project. The office project is kept in your office’s GitHub account. You access that account with your office email. Again your personal GitHub account was opened with your personal email. If your project has a global username and email set, but all projects will show the same name and the same email. That’s why you can no longer use global usernames and emails. Now you need to cut out the global keyword and its previous hyphen. And the commands will be as follows:

1
2
3
4
5
6
7
//Git is configured using an email for the first project
git config user.name "Tortoiz Themes"
git config user.email "tortoizthemes@gmail.com"
//The second project has been configured with another e-mail
git config user.name "Tortoiz Themes"
git config user.email "tortoiz@gmail.com"