Slide 1

Slide 1 text

GitHub Mastery A Collaborative Coding Experience

Slide 2

Slide 2 text

~whoami 1. I am Simar Preet Singh. 2. Software Engineer (FE) at Redaptive Inc. 3. Total Industrial Experience: 6 years. 4. Expertise in: Angular, Reactjs, Nodejs, Firebase, MongoDB, OpenAI Tools… etc. 5. Organiser of Google Developer Groups Jalandhar. 6. Mentor, Speaker and Contributor at Tech Events.

Slide 3

Slide 3 text

Agenda 1. Introduction to Version Control Systems 2. Introduction to Git 3. Basic Concepts of Git 4. Getting Started with Git 5. Introduction to GitHub 6. How to Use GitHub 7. Collaborating with Git and GitHub 8. Best Practices and Tips 9. Why Use Git and GitHub? 10. Q&A

Slide 4

Slide 4 text

1. Introduction to Version Control Systems (VCS)

Slide 5

Slide 5 text

What is Version Control? ● A system that records changes to a file or set of files over time. ● Allows reverting files or projects to a previous state. ● Enables comparison of changes over time, identification of last modifications, and understanding of issues' origins.

Slide 6

Slide 6 text

Importance of Version Control in Software Development ● Collaboration: Facilitates multiple people working on the same project without conflict. ● Backup and Restore: Offers the ability to jump back to any point in the project's history. ● Track Changes: Provides visibility on who made changes, when, and why. ● Branching and Merging: Supports diverging from the main development line to develop features or fix bugs independently.

Slide 7

Slide 7 text

Types of Version Control Systems ● Local VCS: Basic and prone to errors; involves manual copying of files into a different directory. ● Centralized VCS (CVCS): Has a single server for all versioned files and multiple clients that check out files, e.g., CVS, Subversion. ● Distributed VCS (DVCS): Clients fully mirror the repository, including its history. Examples include Git and Mercurial. Offers robust data integrity and collaborative flexibility.

Slide 8

Slide 8 text

2. What is Git?

Slide 9

Slide 9 text

Definition and History of Git ● Definition: Git is a distributed version control system designed to handle everything from small to very large projects with speed and efficiency. ● History: Developed by Linus Torvalds in 2005 for Linux kernel development. Created to improve upon the weaknesses of other VCS tools and to support distributed, non-linear workflows in an efficient manner.

Slide 10

Slide 10 text

Key Features of Git ● Speed: Git is designed for performance. Committing, branching, merging, and comparing past versions are all optimized for speed. ● Data Integrity: Every file and commit is checksummed and retrieved by its checksum at any time. This ensures the integrity of your code history. ● Distributed Workflows: Allows multiple developers to work together on the same project without any central repository. Each developer's copy of the codebase is a complete version control repository. ● Support for Non-linear Workflows: Git supports rapid branching and merging, and includes tools for visualizing and navigating a non-linear development history.

Slide 11

Slide 11 text

Why Git is Preferred Over Other Version Control Systems ● Flexibility in Workflow Choices: Git allows for various workflows - centralized, feature branch, Gitflow, and Forking workflows, among others. ● Robust Branching and Merging: Making and merging branches is a straightforward and fast process. ● Better Performance: Git is significantly faster than most other version control systems, making it ideal for modern development practices. ● Widespread Adoption: Its popularity makes it easier to find integrations, tools, and community support. ● Works Well with Large Projects: Git's performance doesn’t degrade as the project size grows, making it suitable for both small and large projects.

Slide 12

Slide 12 text

3. Understanding the Basics of Git

Slide 13

Slide 13 text

Repository (Local and Remote) ● Local Repository: A database on your computer where Git stores the changes to your project. Contains all of your project's files and the history of changes made to those files. ● Remote Repository: A version of your project hosted on the internet or network, allowing for collaboration. Changes are pushed to and pulled from remote repositories.

Slide 14

Slide 14 text

Commit, Branch, Merge ● Commit: A snapshot of your repository at a specific point in time. Commits include a message describing the changes and allow you to track the history of your project. ● Branch: A separate line of development. Branches allow you to diverge from the main line of development, work on new features, or fix bugs, then merge those changes back into the main project. ● Merge: The process of combining changes from different branches. Merging integrates the histories of the branches, resulting in a single unified history.

Slide 15

Slide 15 text

The Workflow (Working Directory, Staging Area, Repository) ● Working Directory: The local directory on your computer where your files live. You make changes to your files in the working directory. ● Staging Area: An intermediate area where Git tracks changes; also known as the index. Changes can be added to the staging area from the working directory and then committed to the repository. ● Repository: The .git directory inside your project. It stores all of your commits and the history of your project, tracking changes to the project over time.

Slide 16

Slide 16 text

4. Getting Started with Git

Slide 17

Slide 17 text

Installation of Git ● Download Git from git-scm.com. ● Follow the installation guide for your operating system (Windows, macOS, Linux).

Slide 18

Slide 18 text

Setting up Git ● Configure User Name: Set your user name with command git config --global user.name "Your Name" ● Configure Email: Set your email address with command git config --global user.email "[email protected]" ● This information is used in your commits.

Slide 19

Slide 19 text

Creating Your First Git Repository (repo) ● Choose a Project. ● Initialize Repository git init ● First commit git add filename or git add . git commit -m “my first commit”

Slide 20

Slide 20 text

Basic Git Commands ● init: Initialize a new Git repository. ● add: Add file changes to your staging area. ● commit: Save your staged changes along with a commit message explaining what you've done. ● status: Check the status of your changes as compared to your last commit. ● log: View the chronological commit history for the current branch.

Slide 21

Slide 21 text

5. What is GitHub

Slide 22

Slide 22 text

GitHub: A Cloud-based Hosting Service ● Hosts Git repositories in the cloud, providing a web-based interface for project management. ● Facilitates code sharing and publishing within teams or publicly across the global developer community.

Slide 23

Slide 23 text

Key Features of GitHub ● Collaboration: Simplifies team collaboration on projects with tools like pull requests, code review, and branch management. ● Issue Tracking: Offers a comprehensive issue tracking system that integrates directly with your projects, allowing for bug tracking, feature requests, and task management. ● GitHub Actions for CI/CD: Automates your workflow from code to deployment. Build, test, and deploy your code right from GitHub.

Slide 24

Slide 24 text

GitHub vs. Git: Clarifying the Relationship ● Git: A version control system that manages changes to files and coordinates work on those files among multiple people. ● GitHub: A hosting service that uses Git for version control. It extends Git’s capabilities with additional features for project management. ● Essentially, Git is the tool, and GitHub is a service for projects that use Git.

Slide 25

Slide 25 text

6. Getting Started with GitHub

Slide 26

Slide 26 text

Getting Started with GitHub ● Create an Account ● Creating and Cloning Repos ● Access token ● Cloning a repo git clone https://:@ ● Change directory into project that you cloned cd

Slide 27

Slide 27 text

Exploring Open Source Projects on GitHub ● Use GitHub to find open-source projects. Participate by cloning projects, submitting issues, and contributing through pull requests. ● Explore trending projects, contribute to ones you're interested in, and learn from the vast resources available.

Slide 28

Slide 28 text

7. Collaborative Development with Git and GitHub

Slide 29

Slide 29 text

Branching Strategies for Team Projects

Slide 30

Slide 30 text

Pull Requests / Merge Requests ● Requesting to merge your branch ● Code Review by Lead or Manager

Slide 31

Slide 31 text

Handling Merge Conflicts ● Practical approach

Slide 32

Slide 32 text

Forking and Contributing to Open Source Projects ● Practical approach

Slide 33

Slide 33 text

8. Best Practices

Slide 34

Slide 34 text

Best Practices ● Commit Messages: Writing Meaningful Commit Messages ● Keeping Your Repositories Organized ● Use SSH Keys for Authentication ● Review Code for Security Flaws ● Keep Dependencies Updated

Slide 35

Slide 35 text

9. Why use Git and GitHub

Slide 36

Slide 36 text

Why use Git and GitHub ● Enhancing Collaboration and Productivity ● Building an Online Portfolio of Your Work ● Networking and Community Engagement Through Open Source ● Continuous Learning and Improvement Through Real-world Projects

Slide 37

Slide 37 text

10. Q&A

Slide 38

Slide 38 text

Scan to Connect with me @programmersingh Thank you :)