-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
docs: Update Git command guide for better readability
- Loading branch information
1 parent
1daacc4
commit 0d36982
Showing
1 changed file
with
13 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,15 +11,11 @@ author: | |
name: 夏天夏 | ||
link: https://github.com/qq919006380 | ||
--- | ||
## **git常用命令** | ||
- pwd //查看当前完整路劲 | ||
- ssh-keygen -t rsa -b 4096 -C "[email protected]" //创建ssh钥匙 | ||
- 创建成功最后会出现正方形里面有乱码 | ||
本文整理了Git版本控制系统的常用命令、配置方法和最佳实践。包含了从基础操作到分支管理的完整指南,以及常见问题的解决方案。 | ||
<!-- more --> | ||
## git常用命令 | ||
- ssh-keygen -t rsa -b 4096 -C "[email protected]" #创建ssh钥匙,创建成功最后会出现正方形里面有乱码 | ||
- cd ~/.ssh //查找ssh文件 | ||
- mkdir //创建目录 | ||
- rm -rf //删除目录 | ||
- git rm -r --cache 删除远程仓库文件,本地文件不删除 | ||
- touch a.md //创建文件 | ||
- echo “hello” >> a.md //在文件尾部插入一个字符串,一个“>”代表 覆盖。 | ||
- git status //查看仓库当前状态 | ||
- git diff //是工作区(work dict)和暂存区(stage)的比较 | ||
|
@@ -38,15 +34,15 @@ author: | |
- git log -p <文件名>:查看指定文件的每一次提交和改动。 | ||
|
||
## 修改全局用户名和邮箱 | ||
``` | ||
git config --global user.email "[email protected]" | ||
git config --global user.name "weibo" | ||
``` | ||
- git config --global user.email "[email protected]" | ||
- git config --global user.name "weibo" | ||
|
||
## 查看用户名和地址 | ||
``` | ||
git config user.name | ||
git config user.email | ||
``` | ||
|
||
## 修改完后推送上github三步代码 | ||
```shell | ||
git add . // 文件进入暂存区,. 表示添加所有已修改的,-A表示添加所有文件包括删除的 | ||
|
@@ -72,8 +68,11 @@ git config user.email | |
|
||
|
||
## 上传创库 | ||
- 在github官网创建项目,按提示上传 | ||
- 在本地文件输入git init创建git隐藏的跟踪文件 | ||
- 修改提交作者 N是提交数量 `git rebase -i HEAD~N` | ||
- 修改提交 `git commit --amend --author="userName <userEmail>"` | ||
- 继续`git rebase --continue` | ||
- 强制推送`git push -f origin main` | ||
- 查看提交`git log` | ||
|
||
|
||
## 分支管理 | ||
|