Basics Of Unix, Git & Github

Basics Of Unix, Git & Github

FIRST BLOG

UNIX

UNIX is an operating system which was first developed in the 1960s, and has been under constant development ever since. By operating system, we mean the suite of programs which make the computer work. It is a stable, multi-user, multi-tasking system for servers, desktops and laptops. The UNIX operating system is made up of three parts; the kernel, the shell and the programs.

The kernel

The kernel of UNIX is the hub of the operating system: it allocates time and memory to programs and handles the filestore and communications in response to system calls.

The shell

The shell acts as an interface between the user and the kernel. When a user logs in, the login program checks the username and password, and then starts another program called the shell. The shell is a command line interpreter (CLI). It interprets the commands the user types in and arranges for them to be carried out. The commands are themselves programs: when they terminate, the shell gives the user another prompt (% on our systems).

The program

A process is an executing program identified by a unique PID (process identifier). A file is a collection of data. They are created by users using text editors, running compilers etc.

basic commands are-

  1. pwd- tells you where you currently are.
  2. cd- changes directory
  3. cd ..- changes directory back 1 step.
  4. ls - list all the files in a folder.
  5. ls -a - list all the hidden files.
  6. ls -l - list all the files in long form
  7. cp- copies the file
  8. rm- removes the file
  9. clear- clears the terminal
  10. exit- exit the terminal
  11. touch- creates a file
  12. echo- write in a file
  13. nano- updates a file
  14. mkdir- creates a new folder
  15. rmdir- deletes an empty folder

GIT

Git is a version-control system for tracking changes in computer files and coordinating work on those files among multiple people. Git is a Distributed Version Control System. Git helps you keep track of the changes you make to your code. It is basically the history tab for your code editor(With no incognito mode ?). If at any point while coding you hit a fatal error and don’t know what’s causing it you can always revert back to the stable state. So it is very helpful for debugging. Or you can simply see what changes you made to your code over time.

git-repository.jpg

There are four fundamental elements in the Git Workflow.

Working Directory, Staging Area, Local Repository and Remote Repository. If you consider a file in your Working Directory, it can be in three possible states.

It can be staged.

Which means the files with the updated changes are marked to be committed to the local repository but not yet committed.

It can be modified.

Which means the files with the updated changes are not yet stored in the local repository.

It can be committed.

Which means that the changes you made to your file are safely stored in the local repository.

  1. git add -is a command used to add a file that is in the working directory to the staging area.
  2. git commit- is a command used to add all files that are staged to the local repository.
  3. git push- is a command used to add all committed files in the local repository to the remote repository.
  4. git fetch- is a command used to get files from the remote repository to the local repository but not into the working directory.
  5. git merge- is a command used to get the files from the local repository into the working directory.
  6. git pull- is command used to get files from the remote repository directly into the working directory. It is equivalent to a git fetch and a git merge .

GITHUB

GitHub is a code hosting platform for version control and collaboration. It lets you and others work together on projects from anywhere. It consist of 4 parts

  1. Create and use a repository
  2. Start and manage a new branch
  3. Make changes to a file and push them to GitHub as commits
  4. Open and merge a pull request

    1. Create and use a repository

  5. In the upper-right corner of any page, use the drop-down menu, and select New repository. Drop-down with option to create a new repository
  6. In the Repository name box, enter hello-world.
  7. In the Description box, write a short description.
  8. Select Add a README file.
  9. Select whether your repository will be Public or Private.
  10. Click Create repository.

    2. Start and manage a new branch

  11. Click the Code tab of your hello-world repository.
  12. Click the drop down at the top of the file list that says main.
  13. Branch menu
  14. Type a branch name, readme-edits, into the text box.
  15. Click Create branch: readme-edits from main.

    3. Make changes to a file and push them to GitHub as commits

  16. Under the readme-edits branch you created, click the README.md file.
  17. Click to edit the file.
  18. In the editor, write a bit about yourself. Try using different Markdown elements.
  19. In the Commit changes box, write a commit message that describes your changes.
  20. Click Commit changes.

    4. Open and merge a pull request

  21. Click the Pull requests tab of your hello-world repository.
  22. Click New pull request
  23. select the branch you made, readme-edits, to compare with main (the original).
  24. Look over your changes in the diffs on the Compare page, make sure they're what you want to submit.
  25. Click Create pull request.
  26. Give your pull request a title and write a brief description of your changes. You can include emojis and drag and drop images and gifs.
  27. Click Create pull request.
  28. Click Merge pull request to merge the changes into main.
  29. Click Confirm merge. You will receive a message that the request was successfully merged and the request was closed.
  30. Click Delete branch. Now that your pull request is merged and your changes are on main, you can safely delete the readme-edits branch.

these are the few basic things of unix, git and github.