Git and GitHub Workshop

Git and GitHub Workshop

What is GIT?

Git is a distributed version control system for tracking changes in any set of files, originally designed for coordinating work among programmers cooperating on source code during software development. Its goals include speed, data integrity, and support for distributed, non-linear workflows (thousands of parallel branches running on different systems). Git was created by Linus Torvalds in 2005 for the development of the  Linux kernel, with other kernel developers contributing to its initial development. Since 2005, Junio Hamano has been the core maintainer. As with most other distributed version control systems, and unlike most client-server systems, every Git directory on every computer is a full-fledged repository with a complete history and full version-tracking abilities, independent of network access or a central server.

What is GITHUB?

GitHub, Inc. is a provider of Internet hosting for software development and version control using Git. It offers the distributed version control and source code management (SCM) functionality of Git, plus its own features. It provides access control and several collaboration features such as bug trackingfeature requests, task managementcontinuous integration and wikis for every project Headquartered in California, it has been a subsidiary of Microsoft since 2018.

GitHub offers its basic services free of charge. Its more advanced professional and enterprise services are commercial.Free GitHub accounts are commonly used to host open-source projects. As of January 2019, GitHub offers unlimited private repositories to all plans, including free accounts, but allowed only up to three collaborators per repository for free.Starting from April 15, 2020, the free plan allows unlimited collaborators, but restricts private repositories to 2,000 minutes of GitHub Actions per month. As of January 2020, GitHub reports having over 40 million users and more than

What is Version Control System?

Version Control System is the software tool that helps the developer team to track and manage all the changes made to the source code over time. Version Control System is provided by SCM (Source Code Management) tool like Git and GitHub. We need versions to do the rollback (to go to the previous code).

Git is a distributed version-control system for
tracking changes in any set of files, originally
 designed for coordinating work among programmers
 cooperating on source code during software
 development. Its goals include speed, data 
integrity, and support for distributed, non-linear
 workflows.

There are three areas in Git:

  1. Working Area - The Working Area is the area where you are currently working. This area is untracked.
  2. Staging Area - The staging Area contains a database that contains the tracking information. This database is known as "Index".
  3. Commit Area - Commit area contains the snapshot of the data that you added, edited, deleted.

Git Commands:

  • git --version - To see the version of Git.
  • git init - To initialize a repository.
  • git add <file name> - To start tracking.
  • git status - To see which changes have been staged and which haven't.
  • git commit <file name> - To put file in Commit Area.
  • git log - To see history of versions, commit ID, author and time stamp.
  • git reflog - To see reference/versions.
  • git rest <commit ID> <file name> - To do rollback.
  • git branch - To see branches.
  • git checkout -b <branch name> - Switch to new branch.
  • git checkout master - To switch to master branch.
  • git -h - To see help.
  • git remote -v - To see centralized system folder.
  • git push <repo name> master - To upload history.
  • git pull <repo name> master - To download.
  • git show <commit ID> - To see what is modified/removed.
  • git diff <commit ID 1> <commit ID 2> - To compare between versions.
  • git push -u <repo name> <branch name> - To set upstream.
  • git merge <branch name> - To merge with master.
  • git merge squash -<branch name> - To squash the merge.
  • git rebase master - To rebase.
  • git rebase --abort - To abort rebase.

We got to know many things like -

  • Tools that maintain our source code are known as SCM (Source Code Management) tools.
  • Creating a separate branch to develop a feature without disturbing the master branch is known as branching and merging this newly-created branch with the master branch is known as merging.
  • Upstream is from where you clone the repository, and downstream is any project that integrates your work with other works.
  • A merge happens when combining two branches. Git will take two or more commit pointers and attempt to find a common base commit between them. Git has several different methods to find a base commit, these methods are called merge strategies. There are two types of merge strategies - Fast Forward and Recursive.
  • Webhooks are one of a few ways web applications can communicate with each other. It allows you to send real-time data from one application to another whenever a given event occurs. Triggers are a predefined action that activates a webhook or webhooks.
  • The squash is an excellent technique for group-specific changes before forwarding them to others. We can merge several commits into a single commit with the compelling interactive rebase command.
  • Cherry-picking in Git means to choose a commit from one branch and apply it to another.
  • We use Git Stash when we want to record the current state of the working directory and the index, but want to go back to a clean working directory.
  • There are three types of reset - mixed, soft, and hard resets. Mixed reset remove versions from staging and commit area. Soft reset removes the version from the commit area but keeps it in the staging area. Hard reset removes the versions from the staging, commit and work in progress area.

Tools which we have used in the workshop -

  1. GitBash - It is an application that allows us to run Git from the command line.
  2. GitHub - It is a code hosting platform for version control and collaboration. It lets you and others work together on projects from anywhere in the world.
  3. GitKraken - It is a software product for developers and dev teams to help them maximize their productivity with a beautiful and intuitive GUI.
  4. P4Merge - It is a visual diff tool that displays the differences between file versions and helps you to resolve conflicts and merge competing versions into one.

What is Branching?

Branching: Branches help you to work on different versions of a repository at one time. Let’s say you want to add a new feature (which is in the development phase), and you are afraid at the same time whether to make changes to your main project or not. This is where git branching comes to the rescue. Branches allow you to move back and forth between the different states/versions of a project. In the above scenario, you can create a new branch and test the new feature without affecting the main branch. Once you are done with it, you can merge the changes from the new branch to the main branch. Here the main branch is the master branch, which is there in your repository by default. Refer to the below image for better understanding:

Branching

The newly initialized repository created results in a default master branch. Synonymous with production, typically commits are not made directly to this, but rather are reviewed and merged in.Branches can be thought of as an area to silo were to commit. Its reference is specifically a moving pointer to an individual commit object.

What is P4merge?

P4Merge

Using P4Merge to track and compare the effects of past and pending work for branches and individual files with P4Merge. You can also use it to resolve conflicts (even with Git).

Key Features of P4Merge

Visualize Your Merges

Visualize the differences between file versions with P4Merge. Resolve conflicts that result from parallel or concurrent development via color coding and:


  • Highlight and edit text file differences.
  • Choose to include or ignore line endings or white spaces.
  • Recognize line-ending conventions for Windows (CRLF), Mac (CR), and Unix (LF).
  • Use command-line parameters and launch from non-Perforce applications.
  • Display line numbers when comparing and merging files

Thank You Vimal Daga Sir

要查看或添加评论,请登录

Gaurav Rathi的更多文章

  • GUI Application inside Docker

    GUI Application inside Docker

    Docker containers run as a process under the main operating system, you can run multiple containers on a single…

  • Industry Use-Cases of Jenkins

    Industry Use-Cases of Jenkins

    In this article, we are going to learn about the DevOps tool and the name of that tool is Jenkins This is the main tool…

  • Research for Industry Use-Cases of Openshift

    Research for Industry Use-Cases of Openshift

    In this article we are going to learn about OpenShift and how it works and what is the need for these tools in the…

  • NETFLIX-AWS CASE STUDY

    NETFLIX-AWS CASE STUDY

    In this blog, we are going to learn how Netflix uses AWS cloud to run its business. AWS provides resources to Netflix…

  • Industry Use-Case of Neural Networks(NN)

    Industry Use-Case of Neural Networks(NN)

    What is a Neural Network? Neural networks can be taught to perform complex tasks and do not require programming as…

  • AKS-Azure Kubernetes Service

    AKS-Azure Kubernetes Service

    AKS is a good example of INFRASTRUCTURE as a Service and PLATFORM as a Service. Here as we know Azure is a public…

  • Summary of Expert Session Delivered on Kubernetes | Container | Openshift

    Summary of Expert Session Delivered on Kubernetes | Container | Openshift

    Hello Connections, “Expert session on Industry use cases of Kubernetes/OpenShift ” was one of the great sessions. Which…

  • ARTH - Task 14.2 ??????

    ARTH - Task 14.2 ??????

    *Task Description*?? ?? *14.2* Further in ARTH - Task 10 has to create an Ansible playbook that will retrieve new…

  • ARTH - Task 14.3 ??????

    ARTH - Task 14.3 ??????

    Task Description: Create an Ansible Playbook which Dynamically Loads Variable Filename same as OS_Name and just by…

  • ARTH - Task 17 ??????

    ARTH - Task 17 ??????

    Task Description?? ?? Create your own Chat Servers, and establish a network to transfer data using Socket Programing by…

社区洞察

其他会员也浏览了