【github】初学者使用指南

简介: 【github】初学者使用指南


要点-commit只是到本地仓库

Enter git commit -m "[commit message]" to save the changes to your local repository. You can enter anything for the commit message, but adding -m “[commit message]” specifies what this code change is doing, so it’s helpful to be clear and concise.

本地仓库到github-git

Enter git push origin [branch name] to save your code changes to GitHub.

git push origin main

If you haven’t already done so, GitHub will prompt you to authenticate your identity. Enter your GitHub username and password. Once the authentication is done, the upload process will start. After it’s complete, you’ll see specific details about where the data was uploaded.

That’s it! You’ve successfully pushed your local files and folders to your GitHub repository.

To double-check that you pushed to GitHub successfully, open your GitHub repository web page. Your code changes should appear there.

⭐️前言- main

PPS: GitHub has started naming the default branch main instead of master to migrate away from biased terminology (more details available here). In accordance with this industry-wide movement, we have also updated “Learn Git Branching” to use main instead of master in our lessons. This rename should be fairly consistent by now but if you notice any errors, feel free to submit a PR (or open an issue).

🌟 做什么- 改增量

A commit in a git repository records a snapshot of all the (tracked) files in your directory. It’s like a giant copy and paste, but even better!

Git wants to keep commits as lightweight as possible though, so it doesn’t just blindly copy the entire directory every time you commit. It can (when possible) compress a commit as a set of changes, or a “delta”, from one version of the repository to the next.

🌟 保留记录-防作弊

Git also maintains a history of which commits were made when. That’s why most commits have ancestor commits above them – we designate this with arrows in our visualization. Maintaining history is great for everyone working on the project!

☀️总之-是个快照

It’s a lot to take in, but for now you can think of commits as snapshots of the project. Commits are very lightweight and switching between them is wicked fast!

☀️一般- 圣经-早提交

branch early, and branch often

Branches in Git are incredibly lightweight as well. They are simply pointers to a specific commit – nothing more. This is why many Git enthusiasts chant the mantra:

branch early, and branch often

Because there is no storage / memory overhead with making many branches, it’s easier to logically divide up your work than have big beefy branches.

When we start mixing branches and commits, we will see how these two features combine. For now though, just remember that a branch essentially says “I want to include the work of this commit and all parent commits.”

⭐️做法

GitHub 是一个基于 Git 版本控制系统的代码托管平台,它提供了许多功能来管理代码、协作开发和跟踪项目变更。下面是一些 GitHub 的基本用法:

创建仓库(Repository): 在 GitHub 上创建一个新的代码仓库。点击页面右上角的“+”号,选择“New repository”并填写相关信息即可创建一个新的仓库。

克隆仓库(Clone Repository): 使用 Git 命令或者 GitHub Desktop 将远程仓库复制到本地进行编辑和开发。

bash

Copy code

git clone <repository_url>

提交更改(Commit Changes): 将更改保存到本地仓库。使用以下命令:

bash

Copy code

git add <file_name>          # 将文件添加到暂存区
git commit -m "Commit message"    # 将暂存区文件提交到本地仓库
git push origin <branch_name>      # 将本地更改推送到远程仓库

分支管理(Branching): 创建新的分支,合并分支或删除分支。

bash

Copy code

git branch <branch_name>     # 创建新分支
git checkout <branch_name>   # 切换到指定分支
git merge <branch_name>      # 将指定分支合并到当前分支
git branch -d <branch_name>  # 删除指定分支

拉取更新(Pull Request): 提交更改并请求将其合并到主分支(或其他分支)。在 GitHub 上创建 Pull Request,让其他人审查和讨论更改。

问题追踪(Issue Tracking): 创建问题(issue)来讨论和跟踪工作进度,可以在仓库的 Issues 标签下创建和管理。

GitHub Pages: 使用 GitHub 提供的服务托管静态网页。在仓库的 Settings 中启用 GitHub Pages,并选择要发布的内容目录。

这些是 GitHub 的一些基本用法,当然,GitHub 还有更多功能,比如团队协作、代码审查、Actions 等等,这些功能都有助于更好地管理和协作开发项目。


相关文章
|
存储 JavaScript API
vue,uniapp生成二维码
vue,uniapp生成二维码
|
自动驾驶 安全 物联网
2G、3G、4G与5G技术:主要区别详解
2G、3G、4G与5G技术:主要区别详解
7834 14
|
Python
Numpy学习笔记(五):np.concatenate函数和np.append函数用于数组拼接
NumPy库中的`np.concatenate`和`np.append`函数,它们分别用于沿指定轴拼接多个数组以及在指定轴上追加数组元素。
727 0
Numpy学习笔记(五):np.concatenate函数和np.append函数用于数组拼接
|
Linux
CentOS 7.x时间同步服务chrony配置详解
文章详细介绍了在CentOS 7.x系统中如何安装和配置chrony服务,以及它与ntpd服务的对比,强调了chrony在时间同步方面的高效性和准确性。
1374 2
CentOS 7.x时间同步服务chrony配置详解
|
NoSQL Ubuntu Java
在Ubuntu下安装Redis
【1月更文挑战第6天】在Ubuntu下安装Redis
923 106
|
存储 固态存储 安全
阿里云服务器租用价格 2024年最新活动报价及租用收费标准参考
阿里云服务器租用价格是多少?阿里云服务器价格由云服务器配置、实例规格、带宽等组成,进入2024年,阿里云继续推出各种云服务器优惠政策。轻量应用服务器2核2G 61元1年,每天只需0.16元,2核4G 165元1年,每天不到5毛钱;云服务器2核2G3M活动价格只要99元1年,2核4G5M只要199元1年,4核8G最低仅需299元1年;更多配置的阿里云服务器价格表见下文。
2190 0
阿里云服务器租用价格 2024年最新活动报价及租用收费标准参考
|
SQL Java 数据库
5、Mybatis-Plus 常用注解
这篇文章详细介绍了Mybatis-Plus中常用的注解,包括解决实体类与数据库表名不一致、字段不匹配的问题,主键生成策略的配置,以及逻辑删除的实现方法。
5、Mybatis-Plus 常用注解
|
安全 前端开发 物联网
API常见的三种分类
【6月更文挑战第4天】基于现代API的服务对象不同、技术形式不同、使用者不同,可以对现代API做不同类型的划分。
|
存储 缓存 数据库连接
Entity Framework Core 跨数据库查询超厉害!多数据库连接最佳实践,让你的开发更高效!
【8月更文挑战第31天】在现代软件开发中,跨数据库查询是常见需求。Entity Framework Core(EF Core)作为强大的ORM框架,支持多种方法实现这一功能。本文介绍了在EF Core中进行跨数据库查询的最佳实践,包括:理解数据库上下文、使用多个上下文进行查询、处理数据库连接与事务,以及性能优化策略。通过创建独立的数据库上下文如`UserContext`和`OrderContext`,并在业务逻辑中同时使用它们,可以轻松实现跨库查询。此外,利用`TransactionScope`可确保事务一致性,从而提高系统的可靠性和效率。
1130 0
|
SQL 分布式计算 算法
手撕SparkSQL五大JOIN的底层机制
手撕SparkSQL五大JOIN的底层机制
581 0