1. 常用命令

常用命令
2. 远程管理

克隆git下载地址
[root@localhost mnt]# git clone https://github.com/goodboy23/shell-script-collection.git ---把代码库从远程拉到本地上
Cloning into 'shell-script-collection'...
remote: Enumerating objects: 7, done.
remote: Counting objects: 100% (7/7), done.
remote: Compressing objects: 100% (7/7), done.
remote: Total 1086 (delta 1), reused 0 (delta 0), pack-reused 1079
Receiving objects: 100% (1086/1086), 344.99 KiB | 84.00 KiB/s, done.
Resolving deltas: 100% (707/707), done.
Checking connectivity... done.
[root@localhost mnt]# ll
total 4
drwxr-xr-x. 8 root root 4096 Mar 3 00:25 shell-script-collection
[root@localhost shell-script-collection]# ll
total 24
drwxr-xr-x. 2 root root 20 Mar 3 00:25 conf
drwxr-xr-x. 2 root root 53 Mar 3 00:25 lib
drwxr-xr-x. 2 root root 4096 Mar 3 00:25 material
drwxr-xr-x. 2 root root 30 Mar 3 00:25 package
-rw-r--r--. 1 root root 2612 Mar 3 00:25 README.md
drwxr-xr-x. 2 root root 4096 Mar 3 00:25 script
-rwxr-xr-x. 1 root root 9182 Mar 3 00:25 ssc.sh
[root@localhost shell-script-collection]# git status
On branch master ---本身就是一个库,当前在master上
Your branch is up-to-date with 'origin/master'.
nothing to commit, working directory clean
[root@localhost shell-script-collection]# vi README.md ---随便添加点东西保存
[root@localhost shell-script-collection]# git add . ---把工作时的所有变化提交到暂存区,包括文件内容修改(modified)以及新文件(new),但不包括被删除的文件
[root@localhost shell-script-collection]# git commit -m "README update" ---提交代码到本地仓库
[master 711a0d8] README update
1 file changed, 1 insertion(+)
[root@localhost shell-script-collection]# git remote ---列出已经存在的远程分支,其中origin为默认的远程版本库名称
origin
[root@localhost shell-script-collection]# git remote -v
origin https://github.com/goodboy23/shell-script-collection.git (fetch) ---fetch是拉代码下来
origin https://github.com/goodboy23/shell-script-collection.git (push) ---push是传代码上去
[root@localhost shell-script-collection]# git remote add gitlab 192.168.9.111/zheng.git ---添加远程库
[root@localhost shell-script-collection]# git remote add git 192.168.9.222/zheng.git
[root@localhost shell-script-collection]# git remote -v
git 192.168.9.222/zheng.git (fetch)
git 192.168.9.222/zheng.git (push)
gitlab 192.168.9.111/zheng.git (fetch)
gitlab 192.168.9.111/zheng.git (push)
origin https://github.com/goodboy23/shell-script-collection.git (fetch)
origin https://github.com/goodboy23/shell-script-collection.git (push)

远程管理
3. 标签管理
[root@localhost shell-script-collection]# git tag ---查看标签
1.2
V1.2
v1.0
v1.1
v1.2
[root@localhost shell-script-collection]# git tag -a v1.3 -m "feature finished" ---新建标签,-m后面为注释
[root@localhost shell-script-collection]# git tag
1.2
V1.2
v1.0
v1.1
v1.2
v1.3

标签管理
网友评论