“Progress, far from consisting in change, depends on retentiveness. those who cannot remember the past are condemned to repeat it” [George Santayana]
What is Git?
Git is a version control system(software) that maintains and stores information of each and every change made to the files and directories
There are two categories of version control system (VCS)
- A centralized version control system (CVCS)
- A distributed version control system (DVCS)
Examples of CVCS: perforce (paid), CVS(open source), subversion(open source)
Examples of DVCS: mercurial (paid), git (open source)
What is Github?
Git hub is a world largest git repository hosting service, that allows us to create and maintain repositories on their website also allows to integrate local repository with GitHub repository.
Why developers should use Git?
- Helps you to work with multiple developers to coordinate with a set of files
- A tool that tracks changes in the code
- Answer questions like, who made changes which line of code, what is the difference b/w the last month version and the current version, which code section is changed more often, how many lines of code changed compared to the previous release, this questions will be valuable to track bug
- It is better to use git, everything we do in source code control, phone number list, documentation, the procedure to build and release, even the blog text which I am writing
What is a repository?
The repository is a file record or a collection of source code hosted on a remote server, which can be accessed by privately or publicly
What is a client?
The software is used to communicate with the remote server
What is communication?
Communication means accessing the (reading/ writing files) of the repository.
How to use Git?
When we used git client as the bash terminal or a program like IntelliJ, Eclipse, or Android studio which will have a GUI to access repository or a project from the remote server
When git is launched?
Git was first launched in 2005 by Linus Torvalds
How to install git on Ubuntu?
Install Linux by three steps
Step 1: check whether git is installed in your system by typing command in terminal
$ git version
Step 2: install git through the terminal
$ sudo apt-get install git
Step3: check whether git is installed or not through the terminal
$ git version
how to create a repository in GitHub
Step 1: create an account on GitHub
Step 2: start a new project
- Give a name to repository “Demo program”
- Give Description to repository “Demo to test”
- Initialize this repository with a README
- You can choose any license “MIT LICENCE”
Step 3 : Configure git to work on GitHub
1: check whether you have user name email stored in git
$ git config – – global – -list
2: give your GitHub username
$ git config – -global user.name “Anees”
Note: remember to give your GitHub username in git
3: give an email address
$ git config – -global user.email [email protected]
4: check whether your name and email address updated or not
$ git config – -global – -list
Step 4: Cloning GitHub repository to git
Create a directory
$ mkdir git_folder
Get into the folder git_folder
$ Cd git_folder
Copy URL from GitHub git clone (URL)
$ git clone https://github.com/aneescraftsmanship/Demo-program.git
You can see Demo-program is present in folder git_folder by $ ls command
Get into the demo-program folder
$ Cd Demo-program
by $ ls command you can see two files LICENSE README.md
Create a file which we want to commit it in github
$ touch blog.c
You can see, a file called blog.c is created in folder git_folder by $ ls command
In order to edit file blog.c use $ gedit blog.c, which will open text editor, type the code and save
Check git status
$ git status
Transfer git file to git hub $ git add<file name>
$ git add blog.c
Again check git status it will be green
Commit the file (this will be a comment )
$ git commit –m “ a simple demo program” blog.c
Final command to see file into GitHub
$ git push –u origin master
Give user name and password
How to delete GitHub repositories?
Sign in to your GitHub account, click the repository which you would like to delete, then select the option settings, scroll down to view delete this repository option, enter the repository name which you would like to delete finally click I understand the consequences, delete this repository.