常用命令
git add 添加 git status 查看状态 git status -s 状态概览 git diff 对比 git diff --staged 对比暂存区 git commit 提交更新 git reset 回滚 git rm 从版本库中移除 git rm --cached 从暂存区中移除 git mv 改名
分支
分支命令 git branch 例出分支 git branch -v 分支详情 git branch --merged 查看哪些分支被合并 git branch --no-merged 查看哪些分支未被合并 git branch -d testling 删除分支 git checkout 切换分支 git merged 合并分支
编译安装git
# yum install -y curl-devel expat-devel gettext-devel openssl-devel zlib-devel gcc perl-ExtUtils-MakeMaker # wget https://github.com/git/git/archive/v2.7.4.zip # unzip git-v2.7.4.zip # cd git-2.7.4 # make prefix=/usr/local/git all # make prefix=/usr/local/git install # rm -rf /usr/bin/git # ln -s /usr/local/git/bin/git /usr/bin/git # git --version
总结
1、开发经理在gitlab创建项目,分配给开发人员 2、开发人员领取任务后,在本地使用git clone拉取代码 3、开发人员创建开发分支(git checkout -b dev),并进行开发 4、开发人员完成之后,提交到本地仓库(git commit ) 5、开发人员在gitlab界面上,申请分支合并请求(Merge request) 6、开发经理在gitlab上,审核提交的代码,确认无误后,确认将开发人员的分支合并到主分支(master)
邮件配置:
gitlab_rails['time_zone'] = 'Asia/Shanghai' gitlab_rails['gitlab_email_enabled'] = true gitlab_rails['gitlab_email_from'] = 'xiaoming@126.com' gitlab_rails['gitlab_email_display_name'] = 'gitlab' gitlab_rails['smtp_enable'] = true gitlab_rails['smtp_address'] = "smtp.126.com" gitlab_rails['smtp_port'] = 25 gitlab_rails['smtp_user_name'] = "xiaoming" gitlab_rails['smtp_password'] = "your password" gitlab_rails['smtp_domain'] = "126.com" gitlab_rails['smtp_authentication'] = "login"