Git and GitHub – What is GitHub (Part-7)

Posted by

What is GitHub?

GitHub is a web-based platform that uses Git for version control and offers features to facilitate collaboration on software development projects. It hosts your Git repositories and provides a user-friendly interface for managing your projects, collaborating with others, and tracking changes.

Key Features of GitHub:

  1. Repositories: Store your project files and version history.
  2. Branches: Allow you to work on different features or versions of a project simultaneously.
  3. Pull Requests: Facilitate code review and collaboration by proposing changes to be merged into the main project.
  4. Issues: Track bugs, enhancements, and tasks.
  5. Collaborators: Invite others to work on your project with different levels of access.
  6. GitHub Actions: Automate workflows, such as testing and deployment.

Simple Examples to Understand GitHub

Example 1: Creating a Repository

  1. Sign Up and Sign In:
    • Go to GitHub and sign up for an account if you don’t have one.
    • Sign in to your account.
  2. Create organization as free

Create a Repository:

  • Click on the “+” icon in the top right corner and select “New repository”.
  • Fill in the repository name (e.g., my-first-repo), description, and choose whether it will be public or private.
  • Click “Create repository”.

Clone Options:

  • HTTPS: This provides the URL to clone the repository using HTTPS.
  • SSH: This provides the URL to clone the repository using SSH.
  • Clone URL (Highlighted): git@git

you can push or clone from local machine to GitHub or Vice-versa via SSH or HTTPS

Initialize the Repository:

  • You can initialize the repository with a README file, which describes your project.

Clone the Repository:

  • On your local machine, open Git Bash (or any terminal) and run if want to do via Https
    git clone https://github.com/your-username/my-first-repo.git
    

    or via ssh you need to generate SSH Key-gen

    Summary of GitHub Workflow

    1. Creating a Repository: Set up a new project repository on GitHub.
    2. Cloning the Repository: Copy the repository to your local machine.
    3. Making Changes: Add, edit, or delete files in your project.
    4. Staging and Committing: Stage the changes and commit them with a message.
    5. Pushing Changes: Push the commits to the GitHub repository.
    6. Collaborating: Use branches and pull requests to collaborate on changes.
    7. Merging Changes: Merge pull requests after review and approval.

    Benefits of Using GitHub

    • Collaboration: Easy to collaborate with others, review code, and manage projects.
    • Version Control: Track changes and revert to previous versions if needed.
    • Project Management: Use issues, milestones, and project boards to manage tasks.
    • Integration: Integrate with various tools and services like CI/CD pipelines, project management tools, and more.
    guest
    0 Comments
    Inline Feedbacks
    View all comments
    0
    Would love your thoughts, please comment.x
    ()
    x