首页 > 其他分享 >gitlab常用命令

gitlab常用命令

时间:2022-10-15 10:35:18浏览次数:66  
标签:origin git gitlab v1.0 tag master 常用命令

1.gitlab上打标签

(1).上文件到gitlab仓库

拉取gitlab项目

git clone [email protected]:backend_group/it/test2.git

切换分支(切换到master)

cd test2
git checkout master

查看状态

git status

gitlab常用命令_推送

在test2项目下创建相应的文件,然后使用git status查看

$ git status
On branch master
Your branch is up to date with 'origin/master'.

Untracked files:
(use "git add <file>..." to include in what will be committed)
conf.d/
nginx.conf
shell/

nothing added to commit but untracked files present (use "git add" to track)

提交所有修改后的文件

git add . 

将注释信息推送到本地git库

git commit -m "提交代码"

取回远程主机master分支的更新,再与本地的指定分支合并

git pull origin master

把当前提交到git本地仓库的代码推送到远程主机的master分支上

git push origin master

gitlab常用命令_git_02

可以看到对应的文件已经上传到gitlab上。

(2).打tag

查看当前分支

git branch

gitlab常用命令_推送_03

给本次提交打tag标签及添加描述信息

git tag -a v1.0.0 -m "这是一个测试描述"

提交信息到当前分支master

git push origin v1.0.0

gitlab常用命令_git_04

gitlab常用命令_git_05

2.获取对应tag的代码

(1).如果本地没有代码仓库

拉取gitlab项目

git clone [email protected]:backend_group/it/test2.git

查看已存在的tag

cd test2
git tag

gitlab常用命令_推送_06

切换到对应的tag

git switch -c v1.0.0 

gitlab常用命令_代码仓库_07

(2).如果本地已有代码仓库
cd test2
git tag
git switch -c v1.0.0

3.删除tag

(1).删除本地tag
git tag -d v1.0.0
(2).删除远程的tag
git push origin :refs/tags/v1.0.0

gitlab常用命令_代码仓库_08

虽然删除了tag,但是本地还缓存了tag v1.0.0,需要进行切换

git checkout master

gitlab常用命令_git_09

标签:origin,git,gitlab,v1.0,tag,master,常用命令
From: https://blog.51cto.com/u_13753753/5759095

相关文章

  • Ubuntu如何搭建Gitlab
    先贴官方文档:https://packages.gitlab.com/gitlab/gitlab-ce/install 前往官方下载地址查看自己https://packages.gitlab.com/gitlab/gitlab-ce //TODO: 1、官......
  • CentOS7脚本安装GitLab
    #!/bin/bashyuminstall-ycurlpolicycoreutils-pythonopenssh-serverperlsystemctlenablesshdsystemctlstartsshdfirewall-cmd--permanent--add-service=httpfi......
  • Linux常用命令
    cd:切换目录用法:cd绝对路径切换路径cd相对路径切换路径cd~或者cd回到自己的家目录(root目录)cd-回到上一次所在目录cd..回到当前目录的上一......
  • ESXI和VCSA常用命令
    ESXI:一.磁盘类1.查看挂载在主机上的设备ID,设备路径,GUID,存储名等esxcfg-scsidevs-mesxcfg-scsidevs-l2.重新扫描VMFS卷 vmkfstools-V ......
  • Ubuntu常用命令
    一、文件/文件夹管理小技巧:1.在输入命令和路径的时候,按TAB键可以自动补全e.gls/ho-> ls/home2.按↑↓可以翻阅历史3.宿主机和虚拟机之间可以交互(VMware) 查看文件l......
  • gitlab项目迁移步骤
    gitlab迁移分服务端和客户端服务端迁移:旧gitlab导出,下载新gitlab新建->导入,导入根据网络速度需要等待一会  用户端操作变更远端地址指向及用户-密码:ssk-......
  • 部署 GitLab、配置 GitLab、CI/CD 概述、部署 Jenkins
    版本控制版本库版本控制是一种记录一个或若干文件内容变化,以便将来查阅特定版本修订情况的系统。简单来说,就是为目录打快照。将来可以回到某一个历史记录点。是一个典型的......
  • GitLab服务器修改用户密码
    重置密码:1、切换到相应路径cd/opt/gitlab/bin/2、进入控制台gitlab-railsconsole3、根据序号查询用户账号信息并赋值给uu=User.find(2)[注:2为用户序号]4、设置密......
  • Gitlab关闭停用其他不需要的组件
    默认运行的组件[root@gitlabopt]#gitlab-ctlstatusrun:alertmanager:(pid3474)1289193s;run:log:(pid1915)1260609srun:gitaly:(pid3581)1289192s;ru......
  • Git常用命令
    Git中的常用概念工作目录:是一个目录,用于保存仓库项目中所有的文件暂存区:是内存中的一个区域,用于临时存储项目中文件的变化Git仓库:是一个特殊的目录,保存项目中所有的......