Skip to content
Navigation Menu
Sign in
Products
Platform
GitHub
Repository hosting, code review, and collaboration
Copilot
AI coding agent for tasks, projects, and automated work
Build & Ship
Actions
CI/CD and automation
Code Quality
Quality analysis, fixes, and enforcement
Codespaces
Cloud development environments
Secure
Code Security
Vulnerability detection and remediation
Secret Protection
Secret scanning and leak prevention
All Features
Developers
Learn
Documentation
Training
Certifications
Build
Build with Copilot
Customize Copilot
Integrations
Explore
Trending repos
GitHub Sponsors
Developer articles
Changelog
Changelog
Your source for the latest features, improvements, and fixes across GitHub products, all in one place.
Businesses
By Stage
Enterprises
Team
Startups
Nonprofits
By Industry
Healthcare
Financial services
Manufacturing
Government
See all industries
Evaluate GitHub
Why GitHub
Customer Stories
Business insights
Trust Center
Add-ons
GitHub Advanced Security
Enterprise-grade code security
Copilot for business
Enterprise-grade AI features
Premium Support
Enterprise-grade 24/7 support
Resources
Learn & Connect
Documentation
Resource center
Blog
Events & webinars
Community Forum
Customer Stories
Integrations
Support
Customer support
Training
GitHub Status
Company
About
Partners
Changelog
GitHub Universe
GitHub Universe
The event for developers, by developers — talks, workshops, and what’s next for GitHub.
Pricing
Search
/
Sign in
Sign up
Appearance settings
You signed in with another tab or window.
Reload
to refresh your session.
You signed out in another tab or window.
Reload
to refresh your session.
You switched accounts on another tab or window.
Reload
to refresh your session.
Dismiss alert
{{ message }}
HWork-git
Learngit
Repository navigation
Code
Issues
Pull requests
Actions
Projects
Security and quality
Insights
More
items
Files
Expand file tree
master
Breadcrumbs
Learngit
/
Git.txt
Copy path
Blame
More file actions
Blame
More file actions
Latest commit
History
History
History
36 lines (23 loc) · 1.16 KB
master
Breadcrumbs
Learngit
/
Git.txt
Copy path
Top
File metadata and controls
Code
Blame
36 lines (23 loc) · 1.16 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
git add 名字+后缀
git commit -m "描述"
git status 时刻掌握仓库当前的状态
git log 查看历史版本信息 + --pretty =oneline 防止版本信息显示过多
git reset --hard HEAD^ 回退版本命令
git reset --hard +版本号
git reflog 记录库当中的每一次命令
git checkout --文件名+后缀 把文件 在工作区的修改全部撤销
或者可以用git reset HEAD 文件名+后缀 将暂存区的修改撤销掉;
rm 文件名+后缀 删除工作区的文件
确认删除 git rm 版本库当中的文件删除
删错了的情况: git checkout 文件名+后缀
git remote add origin git@github.com:HWork/learngit.git 关联远程库
git push +库名+master 推送分支到远程库
git clone +远程库的地址 克隆一份本地库
git branch +分支名 创建一个分支
git checkout -b 创建并且切换分支
git checkout + 分支名 切换到某一分支
git branch 查看当前分支
git merge 将分支合并到master分支上
git switch -c +分支名 创建并切换到新的分支
git branch -d +分支名 删除某一分支
git log --graph 查看分支合并图
You can’t perform that action at this time.