Introduction to GitHub
Srinivasulu Paranduru
Posted on June 11, 2024
Introduction:
GitHub provides an AI-powered developer platform to build, scale, and deliver secure software. Whether you’re planning new features, fixing bugs, or collaborating on changes, GitHub is where over 100 million developers from across the globe come together to create things and make them even better.
GitHub
GitHub is a cloud-based platform that uses Git, a distributed version control system, at its core. The GitHub platform simplifies the process of collaborating on projects and provides a website, command-line tools, and overall flow that allows developers and users to work together.
Core pillars of the GitHub Enterprise platform
AI - Generative AI is dramatically transforming software development as we speak.
Collaboration - Collaboration is at the core of everything GitHub does.
Repositories, Issues, Pull Requests, and other tools help to enable developers, project managers, operation leaders, and others at the same company to work faster together, cut down approval times, and ship more quickly.Productivity: Productivity is accelerated with automation that the GitHub Enterprise Platform provides. With built-in CI/CD tools directly integrated into the workflow and makes our life easier
Security: Able to take advantage of security overview and Dependabot.
Scale:GitHub is the largest developer community of its kind. With real-time data on over 100M+ developers, 330M+ repositories, and countless deployments, we’ve been able to understand the shifting needs of developers and make changes to our product to match.
Introduction to repositories :
- What is a repository? : A repository contains all of your project's files and each file's revision history. It is one of the essential parts that helps you collaborate with people. You can use repositories to manage your work, track changes, store revision history and work with others.
How to create a repository
- You can create a new repository on your personal account or any organization where you have sufficient permissions.
-
Choose a repository visibility.
- Public repositories are accessible to everyone on the internet.
- Private repositories are only accessible to you, people you explicitly share access with, and, for organization repositories, certain organization members.
Refer the below link for step by step approach for creation of repository and adding files
https://learn.microsoft.com/en-us/training/modules/introduction-to-github/2-what-is-github
What are gists :
- Similarly to repositories, gists are a simplified way to share code snippets with others.
- Every gist is a Git repository, which you can fork and clone and can be either public or secret.
- Public gists are displayed publicly where people can browse new ones as they’re created. Public gists are also searchable.
- Conversely, secret gists are not searchable, but they aren’t entirely private. If you send the URL of a secret gist to a friend, they'll be able to see it.
What are wikis?
- Every repository on GitHub.com comes equipped with a section for hosting documentation, called a wiki.
- You can use your repository's wiki to share long-form content about your project, such as how to use it, how you designed it, or its core principles.
- While a README file quickly tells what your project can do, you can use a wiki to provide additional documentation.
- If your repository is private only people who have at least read access to your repository will have access to your wiki.
Components of the GitHub flow
Will be discussing following components of the GitHub flow:
- Branches
- Commits
- Pull Requests
- The GitHub Flow
What are branches
- Branches are an essential part to the GitHub experience because they're where we can make changes without affecting the entire project we're working on.
- Your branch is a safe place to good with new features or fixes. If you make a mistake, you can revert your changes or push more changes to fix the mistake. Your changes won't update on the default branch until you merge your branch.
You can create a branch using the command
git checkout -b newBranchName
What are commits
Adding a new file or updating existing file into the repository, you needed to push a commit.
A commit is a change to one or more files on a branch. Every time a commit is created, it's assigned a unique ID and tracked, along with the time and contributor. Commits provide a clear audit trail for anyone reviewing the history of a file or linked item, such as an issue or pull request.
Within a git repository, a file can exist in several valid states as it goes through the version control process:
The primary states for a file in a Git repository are:
1.Untracked: An initial state of a file when it isn't yet part of the Git repository. Git is unaware of its existence.
2.Tracked: A tracked file is one that Git is actively monitoring. It can be in one of the following substates:
- Unmodified
- Modified
- Staged
- Committed
What are pull requests?
- A pull request is the mechanism used to signal that the commits from one branch are ready to be merged into another branch.
- The team members submitting pull requests to merge their changes to desired git branch and needs to be assigned to Reviewers, Reviewer will review the code, add comments and developers needs to fix the changes.
The GitHub flow
The GitHub flow can be defined as a lightweight workflow that allows for safe experimentation. You can test new ideas and collaboration with your team by using branching, pull requests, and merging.
GitHub is a collaborative platform
Issues
- GitHub Issues were created to track ideas, feedback, tasks, or bugs for work on GitHub.
- Issues can be created in various ways, so you can choose the most convenient method for your workflow.
- The different ways to create an issue from:
- a repository
- an item in a task list
- a note in a project
- a comment in an issue or pull request
- a specific line of code
- or a URL query
Creating an issue from a repository
- On GitHub.com, navigate to the main page of the repository.
- Under your repository name, select Issues.
- Select New issue.
- If your repository uses issue templates, next to the type of issue you'd like to open, select Get started.
If the type of issue you'd like to open isn't included in the available options, select Open a blank issue.
In the Add a title field, enter a title for your issue.
In the Add a description field, type a description of your issue.
If you're a project maintainer, you can assign the issue to someone, add it to a project board, associate it with a milestone, or apply a label.
When you're finished, select Submit new issue.
Discussions : Discussions are for conversations that need to be accessible to everyone and aren't related to code. Discussions enable fluid, open conversation in a public forum.
Enabling a discussion in your repository :
- Repository owners and people with Write access can enable GitHub Discussions for a community on their public and private repositories.
- The visibility of a discussion is inherited from the repository the discussion is created in.
- When you first enable GitHub Discussions, you're invited to configure a welcome post.
- On GitHub.com, navigate to the main page of the repository.
- Under your repository name, select Settings.
3.Scroll down to the Features section and under Discussions, select Setup discussions.
4.Under Start a new discussion, edit the template to align with the resources and tone you want to set for your community.
5.Select Start discussion.
Create a new discussion
Any authenticated user who can view the repository can create a discussion in that repository.
Similarly, since organization discussions are based on a source repository, any authenticated user who can view the source repository can create a discussion in that organization.
GitHub platform management
- Managing notifications and subscriptions :You can choose to receive ongoing updates about specific activity on GitHub.com through a subscription. Notifications are the updates that you receive for specific activity to which you're subscribed.
-
Subscription options : You can choose to subscribe to notifications for:
- A conversation in a specific issue, pull request, or gist.
- All activity in a repository.
- CI activity, such as the status of workflows in repositories set up with GitHub Actions.
- Repository issues, pull requests, releases, security alerts, or discussions (if enabled).
- In some instances, you're automatically subscribed to conversation. If you want you can unsubscribe.
What are GitHub Pages?
- You can use GitHub Pages to publicize and host a website about yourself, your organization, or your project directly from a repository on GitHub.com.
- GitHub Pages is a static site-hosting service that takes HTML, CSS, and JavaScript files straight from a repository on GitHub. Optionally, you can run the files through a build process and publishes a website.
Exercise - A guided tour of GitHub, use the below link to doing exercise
https://learn.microsoft.com/en-us/training/modules/introduction-to-github/5-platform-management
References:
Conclusion:
💬 If you enjoyed reading this blog post and found it informative, please take a moment to share your thoughts by leaving a review and liking it 😀 and follow me in dev.to , linkedin
Posted on June 11, 2024
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.