惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

G
Google Developers Blog
S
SegmentFault 最新的问题
Jina AI
Jina AI
D
DataBreaches.Net
人人都是产品经理
人人都是产品经理
罗磊的独立博客
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
爱范儿
爱范儿
大猫的无限游戏
大猫的无限游戏
C
Check Point Blog
酷 壳 – CoolShell
酷 壳 – CoolShell
WordPress大学
WordPress大学
博客园 - 三生石上(FineUI控件)
B
Blog
博客园 - 【当耐特】
博客园 - Franky
M
MIT News - Artificial intelligence
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
L
LangChain Blog
MyScale Blog
MyScale Blog
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
博客园 - 叶小钗
Last Week in AI
Last Week in AI
Engineering at Meta
Engineering at Meta

爱吃肉的猫

那就,再相逢 Butterfly的魔改教程:最新评论页 离歌不夜天 前端分享 - 滑动阻尼效果 Butterfly的魔改教程:右键菜单 音乐分享 - doi微醺氛围 Butterfly的魔改教程:动态相册页 近况记事 - 11 微信公众号:Ai大模型让回复更具智能化 近况记事 - 10 PWA:让你的网站变成桌面应用APP Healthy Love Butterfly的魔改教程:关于本站 近况记事 - 9 Butterfly的魔改教程:待办清单 TrollStore - 不掉签助手 近况记事 - 8 Twikoo评论回复邮件模版 过一个很特别的七夕 The Young Boy and the Sea Butterfly的魔改教程:文章订阅页 思考题目:混乱是阶梯 近况记事 - 7 Butterfly的魔改教程:即刻短文页 Butterfly的魔改教程:loading加载动画 差旅游记 再见,不惑之年:二十又一 近况记事 - 6 Butterfly的魔改教程:自定页数跳转 堆友AI作图:3D资源设计平台,堆出你的未来
Git连接仓库常用命令
亦小封 · 2022-04-22 · via 爱吃肉的猫

Git 是一个开源的分布式版本控制系统,用于敏捷高效地处理任何或小或大的项目

我用的是2.34.0版本

可前往 官网 或者 加速站 下载所需版本

同步命令

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
git init


git add .


git commit -m [message]



git remote add origin [Clone]



git push --set-upstream origin master

常用命令库

新建代码库

1
2
3
4
5
6
7
8
9
10
git init


git init [project-name]



git clone [url]


配置

1
2
3
4
5
6
7
8
9
10
11
git config --list



git config -e [--global]


git config [--global] user.name "[name]"
git config [--global] user.email "[email address]"


增减文件

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
git add [file1] [file2] ...



git add [dir]


git add .


git add -p



git rm [file1] [file2] ...



git rm --cached [file]


git mv [file-original] [file-renamed]

代码提交

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
git commit -m [message]


git commit [file1] [file2] ... -m [message]


git commit -a


git commit -v


git commit --amend -m [message]



git commit --amend [file1] [file2] ...

分支

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
git branch


git branch -r


git branch -a


git branch [branch-name]


git checkout -b [branch]


git branch [branch] [commit]


git branch --track [branch] [remote-branch]


git checkout [branch-name]


git checkout -


git branch --set-upstream [branch] [remote-branch]


git merge [branch]


git cherry-pick [commit]


git branch -d [branch-name]


git push origin --delete [branch-name]
git branch -dr [remote/branch]

标签

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
git tag


git tag [tag]


git tag [tag] [commit]


git tag -d [tag]


git push origin :refs/tags/[tagName]


git show [tag]


git push [remote] [tag]


git push [remote] --tags


git checkout -b [branch] [tag]

查看信息

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
git status


git log


git log --stat


git log -S [keyword]


git log [tag] HEAD --pretty=format:%s


git log [tag] HEAD --grep feature


git log --follow [file]
git whatchanged [file]


git log -p [file]


git log -5 --pretty --oneline


git shortlog -sn


git blame [file]


git diff


git diff --cached [file]


git diff HEAD


git diff [first-branch]...[second-branch]


git diff --shortstat "@{0 day ago}"


git show [commit]


git show --name-only [commit]


git show [commit]:[filename]


git reflog

远程同步

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
git fetch [remote]


git remote -v


git remote show [remote]


git remote add [shortname] [url]


git pull [remote] [branch]


git push [remote] [branch]


git push [remote] --force


git push [remote] --all

撤销

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
git checkout [file]


git checkout [commit] [file]


git checkout .


git reset [file]


git reset --hard


git reset [commit]


git reset --hard [commit]


git reset --keep [commit]


git revert [commit]



git stash
git stash pop

Git连接仓库常用命令

此文章版权归 MeuiCat 所有,完整转载,请注明来源!