-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgit.txt
More file actions
68 lines (44 loc) · 1.44 KB
/
git.txt
File metadata and controls
68 lines (44 loc) · 1.44 KB
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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
step1:创建项目的SSH KEY
ssh-keygen -t rsa -C "youremail@example.com"
step2: 登陆github,打开“settings”的SSH and GPG keys页面,点NEW SSH KEY,填写Title 增加KEY
step3: 打开项目clone SSH 代码到本地.
命令 git clone
更改个人名字:
git config --global user.name ''
git config --global user.email ''
setp4:
从远程库获取到本地:
git pull
!!!
从本地提交到远程库
git push origin master
查看暂存区操作
git status
执行 git diff 来查看执行 git status 的结果的详细信息
尚未缓存的改动:git diff
查看已缓存的改动: git diff --cached
查看已缓存的与未缓存的所有改动:git diff HEAD
显示摘要而非整个 diff:git diff --stat
向暂存区提交
git add "file_name"
提交所有 git add -A
确认提交暂存区,添加到仓库
git commit -m '备注信息'
然后把仓库的代码推到GitHub中
git push origin master
!!!
查看历史操作
git log 使用
回退历史版本到暂存区
git reset HEAD^或版本号
git checkout "file_name"
查看配置信息
git config --list
Git 分支管理
创建分支:git branch (branch_name)
切换分支:git checkout (branch_name)
合并分支:git merge
标签
创建标签: git tag -a v1.0 -a 选项意为"创建一个带注解的标签"
查看已有标签: git tag
查看此版本所修改内容: git show v1.0