Some interesting usage scenarios and basic usage methods of github

Getting started with github

Install Git

First, make sure you have Git installed on your computer. You can download and install the version for your operating system from the official Git website (https://git-scm.com/).

Create a GitHub account

If you don't have a GitHub account yet, please register a new account on the GitHub website (https://github.com).

Set up Git locally

Open a command line interface (terminal or command prompt) and run the following commands to configure your Git username and email address:

git config --global user.name "Your Name"
git config --global user.email "[email protected]"

Make sure to replace "Your Name" with your GitHub username and "[email protected]" with your email address.

Clone repository

Navigate to the directory you want to clone in the command line interface and run the following command to clone the GitHub repository locally:

git clone https://github.com/username/repository.git

Replace "username/repository.git" with the URL of the actual repository you want to clone. This will create a local copy (clone) of the repository's directory.

Make changes and submit

Make modifications to the repository locally, such as adding, editing, or deleting files. Then, use the following command in the command line interface to add the modified files to the staging area:

git add .

This will add all modified files to the staging area. If you only want to add a specific file, you can replace "." with the file name.

Next, commit the changes in the staging area to the local repository using the following command:

git commit -m "Commit message"

Replace "Commit message" with your commit message describing the changes in this commit.

Push changes

To push local commits to a GitHub repository, use the following command:

git push origin branch-name

Replace "branch-name" with the name of the branch you want to push to, usually "main" or "master".

Pull updates

If someone else has made changes to the GitHub repository and you want to get those changes, use the following command in the command line interface to pull the updates:

git pull origin branch-name

Replace "branch-name" with the name of the branch you want to pull updates from.

These are the basic steps for working locally with a GitHub repository. Once you master these basics, you can happily use github to manage your code.

Delete abandoned repositories on Github

To delete a repository on GitHub, follow these steps:

  1. Open the GitHub website and log in to your account.
    Insert image description here

2. Navigate to the page of the repository you want to delete.
3. In the upper right corner of the warehouse page, find and click the "Settings" button.
Insert image description here

  1. In the repository settings page, scroll down until you find the "Delete this repository" option. Click this option.
    Insert image description here

  2. On the confirmation page to delete the repository, enter the name of the repository and click "I understand the consequences, delete this repository" to confirm. There will be multiple confirmations here.
    Insert image description here
    Insert image description here
    Insert image description here

  3. Once the operation is complete the repository will be deleted and you will be redirected to your account's home page. After deleting one warehouse, only 2 are left, as follows.
    Insert image description here

Notice

Please note that deleting a repository is an irreversible operation, which means that once deleted, the repository and all its files and commit records cannot be restored. Therefore, please confirm clearly before performing the deletion operation.

More interesting usage scenarios on github

In addition to code management, GitHub has many interesting use cases. Here are some common uses:

Collaborative and social programming

GitHub provides convenient collaboration tools that allow team members to develop projects together. You can create issues (Issues) to track tasks and bugs, use Pull Requests (PR) for code reviews and merges, and discuss and communicate with other developers.

Documentation and knowledge base

GitHub's Markdown support makes it a great platform for creating and maintaining documentation and knowledge bases. You can use GitHub Pages to host a static website, or use a GitHub Wiki to create documentation and instructions for your project.

learning and education

GitHub provides learning and education resources that educational institutions and teachers can use in the classroom. Teachers can create organizations to manage coursework and student projects, and students can share code and resources with teachers and classmates.

Automated workflow

GitHub provides a range of tools and services that can be used to automate workflows and continuous integration (CI)/continuous delivery (CD). You can use GitHub Actions to define and run custom CI/CD processes to automatically build, test, and deploy your applications.

Data Science and Visualization

GitHub provides tools and resources related to data science. You can use Jupyter Notebooks to write and share data analysis code in a repository, use GitHub's dataset functionality to store and share datasets, or use GitHub's visualization tools to create interactive data visualizations.

Used to write blogs

Here are some common ways to blog with GitHub:

GitHub Pages

GitHub Pages is a free static web page hosting service that can use your GitHub repository as a blog website. You write blog posts in Markdown or HTML and submit them to a specific repository (usually one named "username.github.io"), and GitHub Pages automatically renders the files into web pages and publishes them.

Jekyll

Jekyll is a simple static website generator that integrates well with GitHub Pages. You can use Jekyll to create a blog with a custom theme and layout, and then deploy it to GitHub Pages. Jekyll supports Markdown and Liquid template languages, making writing and customizing blogs more flexible and convenient.

Hexo

Hexo is another popular static website generator that can also be integrated with GitHub Pages. Similar to Jekyll, you can use Hexo to create and manage blogs, then submit the generated static files to a GitHub repository and publish them through GitHub Pages.

Third party integration

In addition to using GitHub Pages and static site generators, there are third-party tools and services that can be integrated with GitHub to blog on GitHub. For example, some people use specialized blogging platforms (such as Dev.to, Hashnode, etc.) and associate their blog posts with GitHub by placing links to them in the GitHub repository.

Developer Resume

You can use GitHub to create and host your developer resume. By creating a dedicated repository on GitHub and writing your resume content in Markdown or HTML, you can display your resume alongside your code and projects to showcase your skills and experience.

Plugins and extensions

Many open source projects and software tools use GitHub to host and distribute plug-ins and extensions. You can publish and maintain your own plug-ins by creating a repository, or use GitHub to find and install plug-ins and extensions developed by others.

Summarize

These are just some interesting use cases for GitHub. In fact, GitHub's powerful features and active community make it a diverse platform suitable for all types of projects and application areas. Whether you're a developer, student, teacher, or researcher, GitHub offers many interesting features and resources for you to explore and take advantage of.

Guess you like

Origin blog.csdn.net/yikezhuixun/article/details/132845808