Unix, Git, and GitHub Basics
Introduction of UNIX
Unix is a family of operating systems.it is a stable multi-user, multitasking system for the server, desktop, and laptop. it was designed to be small and capable of a clean service interface. the guideline for the UNIX software recommended making programs that do one thing well and work well with other programs.
Linux and macOS are based on Unix because it’s well-adopted in the industry and has a powerful development environment.
Three main components of the UNIX operating system:-
1-Kernal
2-Shell
3-Applications
KERNAl- The Kernal provides the bridge between the hardware and the user. the core of UNIX is a kernel. the kernel handles the files, memory, devices processes, and the network for the operating system .it is the responsibility of kernel to make sure all the system and user takes are performed correctly.
Shell- The program between the user and the kernel is known as the shell. It accepts and interprets commands through a command-line interface (CLS), its also called Terminal. It translates the many commands that are typed into a terminal session. these commands are known as a shell script. the shell keeps a list of the command you have typed in. if we need to repeat a command, use the cursor keys to scroll up and down the list or type history for a list of the previous commands.
There are two mejor types of shell in UNIX.
1- Bourn shell- if we useing a bourn-type shell, the $ charecter is used the default prompt.
2-C shell- if we use a C shell, then % character is the default prompt.
Basics shell command in UNIX -:
Knowing basic UNIX commands in Unix allow you to navigate your Unix system
1- pwd -prints present working directory. display the full absolute path of the current of the working directory.
2- ls- list all files and folders in a directory.
3- cd- takes an argument, the folder that you want to the argument that you want to navigate to.
4- cd .. navigate to one level up to the present directory.
5- Man -man stands for manual .it basically, prints working manual of particular commands.
6- man ls -give you all the descriptions.
7- clear -use to clear the screen.
8- exit -exits exit the terminal
9- touch - create a file.
10- nano — open a CLI blessed editor used to update a file.
11 - head -read the content of a file from the top.
12 - tail -read the content of the file from the bottom.
13 -cat -cat read the content of one or more files at once.
14- grep -used to search for a string in some content.
15- grep -w search for the word in all files in the current directory.
16 -grep -c count the number of matches.
17-rm -used to delete a file.
18- echo-echo is used to add a line to a file.
19-mkdir -create a folder name in UNIX.
20-mv- move or rename the name of Unix or any folder.
21- rmdir- used to remove the directory.
22-cp- copy file and folder in Unix.
23- rm -r used to remove a non-empty directory.
so, my Unix topic is finished write now. I move to the next topic is about Git
What is Git and why do we need it?
Git is a distributed version control system. that means every developer has there owned copies which will have a local repository (a repository is a place where we can store our codes) and version control means Git will do this version control for us.if we are working on some projects and we don’t have the network connection, that completely fine! in git, we can work on the project and create a different version in our local repository, and if we get a net connection then push it to the server. That is a distributed control system. and the best benefit of using git is we can work on the same project with our team member.the team member can put their project on a remote repository. and every team member is using git on the system & then they can do a pull from a common repository so, they will get a local copy of the project. and then they work own on their local copies and whenever they want they can push it back to the remote repository, and git will take care of all the changes in version control.
Git goes through three stages:-
(a) Working tree ( modified)
(b) staging area (staged)
(c) committed area
(a) working tree - a working tree is consists of a file that we are currently working on. we can think of a working tree as a file system where we can view and modify files.
(b) staging area - git track the file that is in the staging area, git analyze what has changed between the current commit and the last commit.
(c) Committed area - the change has been committed .the final stage is to commit the change.
Git commands -Git commands are used to access the Git working directory and connect it to our remote repository, by making changes, viewing different files, and many other possibilities!
what each one means, and how to use them.
1- $ git config -
it to configure the author’s name, email address, file formats, and many more to be used with commits.
2- $git init -
Using this command it sure that your git repository is initialized and creates the initial .git directory in a new or in an existing project. the git init commands transform the git current directory into a git directory.
3-$ git add -
git add commands to add a change made to a local file to the staging area.
4- $git status -
It determines which change is in which state .it basically gives us the current status of the repository.
5- $git commits -
The commits command will save all staged change, along with a brief description from the user and a commit to the local repository. a commit to a repository is a snapshot of the current state of the project's root directory.
we make commit by running a command called -
$git commit -m “add something ”
6- git restore
7-git diff
8-git log
9-git checkout
In git, we see the branching and merging-
what is git branching and merging-
in git, branches are part of your everyday development process. git branches are effectively a pointer to a snapshot of your change. branches are just pointer to commit. the git branch commands primary function are to create, list, rename and delete branches. git branches command work on local as well as remote branches so that’s why we need branching in git.
and now we merge two branches so we have two branches index.txt and master branch ( default branch) index.txt has a feature, which is about myself, the index.txt contain a feature that we want and we think its ready go, we can bring the content of the index.txt branch into the master branch by using git merge. To do a merge (locally), index.txt the branch you want to merge into then type
=> $ git merge <branch name> (where branch name is a branch you want to merge them.) so, we are on the master branch and want to merge in index.txt so we do
$ git merge index.txt
What is GitHub???
GitHub is a code hosting platform for version control and collaboration.GitHub is a platform that helps people solve problems by building software together.GitHub uses to build some most powerful applications in the world.
how GitHub works ??
GitHub works to do the project with a team . on Github everyone has a copy of a project.you can share your project on the world or invites your friends to help or can keep your project private and still have easy access where -ever you are. team members can work on a file and easily merge there change in the master branch of the projects.
what is repository in github?
A repository ia just a directory in your project root directory. it is storeage space where your project lives. repository on your local own computer will be called local repository. the github repository acts as your remote repository.
Collaborate into branches and change code on GitHub by using the Github flow:
What is branching in GitHub?
In Github, branches are part of your everyday development process. git branches are effectively a pointer to a snapshot of your change. branches are just pointer to commit. the git branch commands primary function are to create, list, rename and delete branches. git branches command work on local as well as remote branches so that’s why we need branching in git.
how to use GitHub: operations commit command:-
A commits to a repository is a snapshot of the current state of the project's root directory. this operation helps you to save the change in your file.when you commit a file you should always provide a massage .this This commit a message to maintain the history of change which in turn helps the other contributors to understand the file better.
What is Github flow?
- GitHub flow starts by creating a branch of a master. when you create a branch on your projects its copy in the project a nap point of time into a parallel space environment.