栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 系统运维 > 运维 > Linux

GitLab命令的使用

Linux 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

GitLab命令的使用

GitLab命令的使用
  • 获取 Git 仓库

获取 Git 仓库

通常有两种获取 Git 项目仓库的方式:

  1. 将尚未进行版本控制的本地目录转换为 Git 仓库;
  2. 从其它服务器 克隆 一个已存在的 Git 仓库。

两种方式都会在你的本地机器上得到一个工作就绪的 Git 仓库。

推送现有文件夹

首先需要进入该项目目录中

cd /c/user/my_project

之后执行:

git init
git remote add origin git@git-server:zhangcx/a.git
git add .
git commit -m "Initial commit"
git push -u origin master

检查当前文件状态

git status

忽略文件

cat .gitignore

查看历史提交

git log //查看历史提交由近到远依次显示
git log -p -2 //查看历史提交并可查看提交的差异
git log --stat

撤销操作

git commit --amend

查看远程仓库

git remote -v

添加远程仓库

git remote
origin
git remote add pb https://github.com/paulboone/ticgit
git remote -v
origin	https://github.com/schacon/ticgit (fetch)
origin	https://github.com/schacon/ticgit (push)
pb	https://github.com/paulboone/ticgit (fetch)
pb	https://github.com/paulboone/ticgit (push)

从远程仓库中抓取与拉取

git fetch 

推送到远程仓库

git push origin master

查看某个远程仓库

git remote show origin

远程仓库的重命名与移除

git remote rename pb paul
git remote remove paul

打标签

git tag -a v1.4 -m "my version 1.4" //创建标签并附注标签
git tag // 列出标签
git show v1.4 //查看标签信息

分支创建

git branch testing

分支切换

git checkout testing

新建一个分支并同时切换到那个分支上
这个命令相当于以上的分支创建和分支切换两条命令

git checkout -b iss53

分支的合并
你只需要检出到你想合并入的分支,然后运行 git merge 命令:

git checkout master
git merge iss53

分支管理

git branch //查看分支
git branch --merged //查看哪些分支已经合并到当前分支
git branch --no-merged //查看所有包含未合并工作的分支
转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/277525.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号