-
Notifications
You must be signed in to change notification settings - Fork 0
/
2.txt
49 lines (40 loc) · 1.83 KB
/
2.txt
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
//git笔记
//1. git config --global user.name "gaopeng"
//2. git config --glabal user.email "592908853@qq.com"
//3. git config --list 查看用户和邮箱
//4. mkdir learngit 创建文件夹
//5. cd learngit
//6. git init 初始化git仓库
//7. ls -a 查看隐藏文件 (ctrl+l清屏)
//8. touch test.txt 创建文件
//9. open test.txt 打开文件
//10. vim test.txt编辑 :wq 保存退出
//11. git add test.txt 工作区声明的文件,没有正式提交
//12. git commit -m '修改描述'
//13. git status 查看工作区的状态
//14. git diff 查看修改的内容 +号代表新增的 -代表删除的
//15. git log 查看历史版本的提交记录 commit是提交的id值 (HEAD->MASTER)最新一次提交 master主分支
//16. git reflog 缩小版的历史记录(常用这个进行版本穿梭)
//17. git reset --hard HEAD^回退到上一次记录
//18. cat text.txt 查看文件内容
// 第一次修改add添加到了暂存区,接着第二次修改没有添加到暂存区 然后 git commit 提交 git status查看状态(提示有一个没有添加到暂存区)选择checkout 放弃修改 git diff文件在
// 19. git checkout -- test.txt 丢弃工作区内容的修改
// 新commit提交的文件删除以及恢复
// git rm 2.txt 删除文件
// git status 查看状态 提示如下
// (use "git add/rm <file>..." to update what will be committed)
// (use "git checkout -- <file>..." to discard changes in working directory)
// git checkout -- 2.txt 暂存区恢复到工作区
// git rm 2.txt 从暂存区彻底删除
// git status 提示 (use "git reset HEAD <file>..." to unstage)
// git reset HEAD 2.txt 从暂存区恢复,然后checkout 恢复到工作区
// ssh-keygen -t rsa -C "592908853@qq.com" 生成秘钥
// id_rsa中的内容便是私钥,id_rsa.pub中的内容便是公钥。
// 打开github点击头像->setting-> ssh 添加公钥 必须用文本复制形式,cat或者vim查看复制保存key会报错
// git鼓励大量使用分支
// 查看分支 git branch
// 创建分支 git branch test1
// 切换分支 git checkout test1
// 创建+切换分支 git checkout -b test1
// 合并某分支到当前分支 git merge test1
// 删除分支 git branch -D test1