Git and Github for  Devops Engineer

Git and Github for Devops Engineer

hey guys, I am back with another exciting topic among all the developers or students.

GitHub

  • GitHub is GOI which means graphical interface.

  • GitHub is open source it means anybody can change your code.

  • it is a community-based server.

  • you can share your project here.

  • you can make some awesome repositories.

Git

  • Git is CLI which means command line interface.
  • Git was originally authored by Linus Torvalds in 2005.
  • Git is a thing that you can downlode on your local server.
  • Git is a version control system which means you have control

    over all the files in a root directory

  • Version control, also known as source control it is a kind of practice of tracking and managing changes to software code.

    • For example:- If someone has changed the code in your file and does another commit and you don't like that so you can revert that commit by using a command called revert.

    • If you wanna push the file from your local server to a remote server which is Github you can.

    • If you have deleted any file by mistake so you can retrieve that file so easily.

    • In Git you can make some branches and so work over them. There is one main branch that is master in Git but In git hub

      it is main by default.

    • There are some Important terms in Git are as follows:-

      • Repository ->A repository is a place where you have all your codes or kind of folder on the server.

      • Server -> It stores all repositories.

      • Working directory -> where you can see files and do the modifications.

      • commit -> Store changes in the repository. you will get one commit-id. it is 40 Alpha-Numeric characters.

      • push -> Push operations copy changes from a local repository server to a remote or central repository. This is used to store the changes permanently in the git repository.

      • pull -> Pull operation copies the changes from a remote repository to a local machine. The pull operation is used for synchronization between the repository.

    • There are some stages in Git are as follows:-

      • Working Directory -> It is the directory where you can see all your files and work on them.

      • Staging area -> There is a command in Git that is git add <file name> which means your file is staged it is still untracked but staged means it is ready to be in a git directory.

      • Git Directory -> git directory is a directory where all important code files are stored safely if someone deletes files so you can restore them. you can make a normal directory into a git directory via a command that we will see after some time.

    • There are some Important Git commands are as follows:-

      • git init -> Initialise an empty Repository.

      • git clone <repository url> -> clone an existing Git repository.

      • git add -> Add file/stage to Git.

      • git commit -m "you commit message" -> commit all the staged files to Git.

      • git restore<filename> -> Restore files if it was deleted by mistake.

      • git status -> shot the status of your Git repository.

      • git branch -> show the branches of your git repository.

      • git checkout -b <branch name> -> checkout to a new branch.

      • git remote -v -> show remote origin URL.

      • git remote add origin <you remote git url> -> Add remote URL.