git-lab 本地代码托管
docker image
https://docs.gitlab.com/omnibus/docker/#run-the-image
使用说明
https://docs.gitlab.com/omnibus/docker/
启动 gitlab 后台服务
docker run --detach \
--hostname gitlab.example.com \
--publish 8929:80 --publish 2289:22 \
--name gitlab \
--restart always \
--volume /srv/gitlab/config:/etc/gitlab \
--volume /srv/gitlab/logs:/var/log/gitlab \
--volume /srv/gitlab/data:/var/opt/gitlab \
gitlab/gitlab-ce:latest
STMP 设置
https://docs.gitlab.com/omnibus/settings/smtp.html
Git 命令 常规用法
git init --- 初始化仓库, .git目录下存放管理所需的仓库数据,称为附属于仓库的工作树
git status --- 查看仓库状态,提供操作参考的反馈
git log --- 查看提交日志
git log --pretty=oneline
git reflog --- 查看仓库的操作日志
git add --- 把文件加入暂存区,进入到本地版本管里系统之下
git add命令实际上就是把要提交的所有修改放到暂存区(Stage),然后,执行git commit就可以一次性把暂存区的所有修改提交到分支
git commit --- 提交到记录中,保存到仓库历史记录(定制时间节点?),要求编写详细的提交信息
git commit -m --- 提交“概述"
git commit -am --- 一次完成缓存与提交记录git reset HEAD file
git diff --- 查看工作树与暂存区的差别
git push --- 提交到github上
分支作业
通过灵活运用分支,可以让多人同时高效地进行并行开发
git branch --- 显示本地分支一览表
git brandh -a --- 查看本地远程的分支信息
git branch $brandchname --- 创建分支
git branch -d $brandchname --- 合并后的分支删除
git branch -D $brandchname --- 强制删除
git checkout -b --- 创建/签出分支
git checkout - --- 切换到上一个分支
git checkout -- file --- 迁出记录中的某文档
在开发过程中往往会安排master为主干分支,而开发任务集中在特征分支上
git rm --- 删除
git merge --- 合并分支
远程操作
git remote -v 查看详细的服务端仓库信息
git remote add --- 添加远程仓库,把本地仓库绑定到github上的远程仓库
git push -u --- 把远程仓库的分支作为当前分支的上游,对于特征分支也适用,把本地内容推送到远程仓库
git clone --- 获取远程仓库,会默认处于master分支上
git checkout -b feature-D origin/feature-D --- 切换到remote feature-D分支以feature-D命名
git pull --- 获取最新记录的远程仓库
分支管理策略(strategy)
git branch
git branch -d 删除分支
git checkout
git checkout -b
git merge 对于图拓扑结构,使用的是Fast-forward快进模式
git merge --no-ff -m "merge with no-ff" fork 使用recursive递归策略,这样同时使分支的记录整合一起,分支删除后仍然有效
网友评论