【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 等等,这些功能都有助于更好地管理和协作开发项目。


相关文章
|
9月前
|
开发工具 git
[github初学者教程] 分支管理-以及问题解决
[github初学者教程] 分支管理-以及问题解决
87 0
|
存储 JavaScript BI
GitHub:GitHub简介、使用方法、经验总结(图文教程)之详细攻略(持续更新!)
GitHub:GitHub简介、使用方法、经验总结(图文教程)之详细攻略(持续更新!)
|
8月前
|
Python
GitHub爆赞!终于有大佬把《Python学习手册》学习笔记分享出来了
这份笔记的目标是为了给出一份比较精炼,但是又要浅显易懂的Python教程。《Python学习手册》中文第四版虽然比较简单,但是措辞比较罗嗦,而且一个语法点往往散落在多个章节,不方便读者总结。 我在做笔记时,将一个知识点的内容都统筹在一个章节里面,因此提炼性大大提高。而且还有《Python学习手册》中文第四版的翻译在某些章节(可能难度较大?)措辞可能前后矛盾。当知识点提炼之后就能够很快的找到一些难以理解的概念的上下文,方便吃透这些难点。
|
9月前
|
数据采集 机器学习/深度学习 JavaScript
5个火爆 GitHub 的 Python 练习项目,快来收藏!
5个火爆 GitHub 的 Python 练习项目,快来收藏!
605 0
|
搜索推荐 开发者
新手GitHub使用指南
新手GitHub使用指南
145 0
|
数据采集 算法 搜索推荐
极简 Github 上手教程
Github 是现在广泛流行的代码托管平台,很多开源项目都把代码放在这里。之前我们有过关于 git 使用的入门教程(从公众号底部菜单栏可进入)。今天,再来科普一下如何把代码放在 github 上。
|
Web App开发 开发工具 开发者
工具分享【二】GitHub 源码查看神器
工欲善其事,必先利其器,最后一个惊艳到你
606 0
工具分享【二】GitHub 源码查看神器
|
Linux Shell 网络安全
Github使用指南
1.创建自己的代码仓库 这很简单,您只需要按照Github上的提示进行创建即可🙌 填写您的代码仓库的基本信息,当然,您也可以选择在创建仓库的同时初始添加README,.gitignore,以及license文件
298 0
Github使用指南
|
开发工具 git
小白进阶,带你玩转Github~
小白进阶,带你玩转Github~
小白进阶,带你玩转Github~
|
机器学习/深度学习 程序员 开发工具
程序员做饭指南,GitHub教程来了
1、来看看GitHub这个神奇的网站 2、如何参与GitHub开源项目? 第一步:fork项目 第二步:下载项目 第三步:修改项目 第四步:提交项目 第五步:推送请求 Pull requests
504 2
程序员做饭指南,GitHub教程来了