@@ -63,25 +63,35 @@ tag 创建,列出,删除或验证使用GPG签名的标签对象
63
63
64
64
init
65
65
66
- ` git init` # 初始化
66
+ ` ` ` shell
67
+ git init # 初始化
68
+ ` ` `
67
69
68
70
status
69
71
70
- ` git status` # 获取状态
72
+ ` ` ` shell
73
+ git status # 获取状态
74
+ ` ` `
71
75
72
76
add
73
77
74
- ` git add file` # .或*代表全部添加
75
- ` git rm --cached < added_file_to_undo> ` # 在commit之前撤销git add操作
76
- ` git reset head` # 好像比上面` git rm --cached` 更方便
78
+ ` ` ` shell
79
+ git add file # .或*代表全部添加
80
+ git rm --cached < added_file_to_undo> # 在commit之前撤销git add操作
81
+ git reset head # 好像比上面`git rm --cached`更方便
82
+ ` ` `
77
83
78
84
commit
79
85
80
- ` git commit -m " message" ` # 此处注意乱码
86
+ ` ` ` shell
87
+ git commit -m " message" # 此处注意乱码
88
+ ` ` `
81
89
82
90
remote
83
91
84
- ` git remote add origin git@github.com:JSLite/test.git` # 添加源
92
+ ` ` ` shell
93
+ git remote add origin git@github.com:JSLite/test.git # 添加源
94
+ ` ` `
85
95
86
96
push
87
97
@@ -93,9 +103,11 @@ git push -f origin master # 强制推送文件,缩写 -f(全写--force)
93
103
94
104
clone
95
105
96
- ` git clone git://github.com/JSLite/JSLite.js.git`
97
- ` git clone git://github.com/JSLite/JSLite.js.git mypro` # 克隆到自定义文件夹
98
- ` git clone [user@]example.com:path/to/repo.git/` # SSH协议还有另一种写法。
106
+ ` ` ` shell
107
+ git clone git://github.com/JSLite/JSLite.js.git
108
+ git clone git://github.com/JSLite/JSLite.js.git mypro # 克隆到自定义文件夹
109
+ git clone [user@]example.com:path/to/repo.git/ # SSH协议还有另一种写法。
110
+ ` ` `
99
111
100
112
git clone支持多种协议,除了HTTP(s)以外,还支持SSH、Git、本地文件协议等,下面是一些例子。` git clone < 版本库的网址> < 本地目录名> `
101
113
@@ -156,7 +168,9 @@ ssh -T git@github.com # 测试是否成功
156
168
157
169
** 3.修改config文件**
158
170
159
- ` vim ~ /.ssh/config` # 修改config文件,如果没有创建 ` config`
171
+ ` ` ` shell
172
+ vim ~ /.ssh/config # 修改config文件,如果没有创建 `config`
173
+ ` ` `
160
174
161
175
` ` ` shell
162
176
Host jslite.github.com
@@ -269,7 +283,9 @@ usage: git remote set-url [--push] <name> <newurl> [<oldurl>]
269
283
or: git remote set-url --delete < name> < url>
270
284
` ` `
271
285
272
- ` git remote set-url --delete origin https://oschina.net/wang/JSLite.js.git`
286
+ ` ` ` shell
287
+ git remote set-url --delete origin https://oschina.net/wang/JSLite.js.git
288
+ ` ` `
273
289
274
290
** 3.推送代码**
275
291
@@ -634,25 +650,35 @@ git config --global core.quotepath false
634
650
635
651
# ## init
636
652
637
- ` git init` # 初始化
653
+ ` ` ` shell
654
+ git init # 初始化
655
+ ` ` `
638
656
639
657
# ## status
640
658
641
- ` git status` # 获取状态
659
+ ` ` ` shell
660
+ git status # 获取状态
661
+ ` ` `
642
662
643
663
# ## add
644
664
645
- ` git add file` # .或*代表全部添加
646
- ` git rm --cached < added_file_to_undo> ` # 在commit之前撤销git add操作
647
- ` git reset head` # 好像比上面`git rm --cached`更方便
665
+ ` ` ` shell
666
+ git add file # .或*代表全部添加
667
+ git rm --cached <added_file_to_undo> # 在commit之前撤销git add操作
668
+ git reset head # 好像比上面 ` git rm --cached` 更方便
669
+ ` ` `
648
670
649
671
# ## commit
650
672
651
- ` git commit -m " message" ` # 此处注意乱码
673
+ ` ` ` shell
674
+ git commit -m " message" # 此处注意乱码
675
+ ` ` `
652
676
653
677
# ## remote
654
678
655
- ` git remote add origin git@github.com:JSLite/test.git` # 添加源
679
+ ` ` ` shell
680
+ git remote add origin git@github.com:JSLite/test.git # 添加源
681
+ ` ` `
656
682
657
683
# ## push
658
684
@@ -664,9 +690,11 @@ git push -f origin master # 强制推送文件,缩写 -f(全写--force)
664
690
665
691
# # clone
666
692
667
- ` git clone git://github.com/JSLite/JSLite.js.git`
668
- ` git clone git://github.com/JSLite/JSLite.js.git mypro` # 克隆到自定义文件夹
669
- ` git clone [user@]example.com:path/to/repo.git/` # SSH协议还有另一种写法。
693
+ ` ` ` shell
694
+ git clone git://github.com/JSLite/JSLite.js.git
695
+ git clone git://github.com/JSLite/JSLite.js.git mypro # 克隆到自定义文件夹
696
+ git clone [user@]example.com:path/to/repo.git/ # SSH协议还有另一种写法。
697
+ ` ` `
670
698
671
699
git clone支持多种协议,除了HTTP(s)以外,还支持SSH、Git、本地文件协议等,下面是一些例子。` git clone < 版本库的网址> < 本地目录名> `
672
700
@@ -817,7 +845,9 @@ git push -u origin branchName # 提交分支到远程origin主机中
817
845
818
846
# ## 拉取
819
847
820
- ` git fetch -p` # 拉取远程分支时,自动清理 远程分支已删除,本地还存在的对应同名分支。
848
+ ` ` ` shell
849
+ git fetch -p # 拉取远程分支时,自动清理 远程分支已删除,本地还存在的对应同名分支。
850
+ ` ` `
821
851
822
852
# ## 分支合并
823
853
@@ -830,7 +860,9 @@ git merge test # 将test分支合并到当前分支
830
860
831
861
# ## 重命名
832
862
833
- ` git branch -m old new` # 重命名分支
863
+ ` ` ` shell
864
+ git branch -m old new # 重命名分支
865
+ ` ` `
834
866
835
867
# ## 查看
836
868
0 commit comments