gitlab使用

前期配置

# 获取密匙
$ ssh-keygen -t rsa -C “邮箱地址”
# 在C:\用户\user\.ssh中找到id_rsa.pub,然后登录到gitlab设置中添加密钥
# 简单配置
git config --global user.name “你github的名字” 
git config –global user.email “你的github邮箱地址”

正式使用

# 项目目录下创建一个.git文件夹
git init
# 将本地的仓库关联到github上
git remote add origin git@******.git
# 将所有文件添加到仓库中
git add .
# 提交改动
git commit -m "first commit"
# 上传到github远程仓库
git push origin master

 查看日志

# 查看日志
# -p显示每次提交的内容差异,-3显示最近的3次更新
git log -p -3

分支管理

# 创建分支
git branch branch
# 跳转分支
git checkout branch
# 以上可合并为
git checkout -b branch

# 查看分支
git fetch

# 提交改变
git commit -a -m 'Something changed'
# 推送分支到gitlab
git push -u origin branch

 

posted @ 2019-07-31 20:48  绿谷  阅读(118)  评论(0编辑  收藏  举报