What is Git?
There is a clear distinction between Git & GitHub. Both have their specific purpose for the developers and coders.
Git is a shared version control system used during software development to track changes in source code. It is designed to organize work between developers, but it can be used in any collection of files to track changes. Its objectives include speed, data integrity and support for non-linear distributed workflows
Git gets installed on your local system. In most of the software development works, there are teams that work on different modules of a software. This results in different versions of the same project. For example, someone makes a change in a component at his end and the same component is to be shared and used at other developer’s machine, in this case Git will take care of this provided the other developer has Git installed at his system. Git allows you to push and pull your and other’s changes. This qualifies Git as a distributed version control tool or system.
It is important to understand how Git is different from other VCSs. The interface of Git tool is very much similar to other VCSs however, Git has its own unique way of storing and interpreting the information.
The other VCSs like CVS, Subversion, Perforce etc etc. normally used delta-based version control. These tools perceive the information they store as a set of files and the changes made to each file over time.
Git Stores data in a different way. With Git, whenever you commit or save your project status, Git basically takes a picture of what all of your files look like at that time and stores a reference to that snapshot. To be effective, Git does not store the file again if files have not changed, just a link to the previous identical file that it has already stored.
Git has integrity as everything in Git is check-summed before it is stored, and it then gets referred by that checksum. This makes it impossible to alter the contents of any file without Git knowing about it.
Common Git Commands
• git config --global user.name "John Doe",
git config --global user.email email@example.com
Configure the author name and email address to be used with your commits.
• git init : Create a new local repository
• git clone /path/to/repository : Create a working copy of a local repository
• git add <filename> : Add Files
• git commit -m "Commit message" : Commit changes to head
• git push origin master : Send changes to the master branch of your remote repository
• git status : List the files you've changed and those you still need to add or commit
• git checkout -b <branchname> : Create a new branch and switch to it
• git pull : Fetch and merge changes on the remote server to your working directory
• git merge <branchname> : To merge a different branch into your active branch
• git grep "foo()" : Search the working directory for foo()
What is GitHub?
GitHub offers code hosting services that allow developers to build software in organizations for open source and private projects.
GitHub is a web-based hosting service. It provides all of the distributed version control and source code management (SCM) functionalities of Git and adds on top a few of its own features.
Although Git is a command-line tool, GitHub is a visual web-based interface that offers access control, simple task management tools, and several collaboration features.
In addition, GitHub will host the source code of your project in different programming languages and monitor changes made to each iteration.
It provides three extraordinary features that make it even more powerful: fork: or commonly referred to as forking. It copies a folder from the account of one user if you do not have the required access to it. And, under your own account, you can just copy it and change it.
Pull: If you made changes to a piece of code you copied and would like to share with the original owner of the software you copied.