git 1、git常用命令

1 git配置
git config --global user.name  <your_name> : 设置用户名
git config --global user.email  <your_email> :设置邮箱 
git config --global gitreview.username  <your_name>:

重新生成拷贝代码的密码:
在root目录下执行:ssh-keygen -t rsa -C "<your_email>"
一路回车:
cat .ssh/id_rsa.pub
将结果拷贝到branches中project下面第三个tab

查看配置:
git config --list
输出结果样例如下:
user.name=<your_name>
user.email=<your_email>
gitreview.username=<your_name>
core.repositoryformatversion=0
core.filemode=true
core.bare=false
core.logallrefupdates=true
remote.origin.url=ssh://...
remote.origin.fetch=+refs/heads/*:refs/remotes/origin/*


2 git rebase用法
git rebase: 将分支点向前移动,具有新的功能。

git checkout <system_branch>
git pull origin <system_branch>
git checkout <your_branch>
git rebase <system_branch>
通过:
git status查看冲突的文件,然后通过编辑冲突的文件,

<<

>>

<<
类似这种内容的冲突解决即可,
然后git add <冲突的文件>
git review -vvv -r origin <system_branch>


3 git commit用法
第一次提交:
git commit -m 'Yout commit title

Detailed information about your commit

Closes-Bug:#bug-id
'

第二次提交:
git commit --amend

如果提交到master分支:
git review -vvv -r origin master

git commit -m story #3, add user model': -m 是消息的意思

4 git clone用法
git clone ssh://... -b stable/2.6  :下载2.6分支
等同于:
git clone ssh://...
git checkout -b your-branch stable/2.6 :创建并切换到分支your-branch

5 git add用法
git add 文件名
git add --all :将所有修改部分添加到暂存区域,将所有跟踪文件,修改删除,新增的文件都添加到暂存区域


6 git commit用法

git review -vvv -r origin stable/3.4  需要指定提交的版本 git review不对
git log

7 其他
git diff
git log
git branch
git pull

git remote add gerrit ssh://...

8 安装git
yum install git-review
yum search review
 sudo yum install python-requests
yum install epel-release  :实际上就是添加扩展源
yum install git-review
先为yum添加epel源:yum install epel-release回
解释:
git config --list 查看已有的配置信息
git remote 列出所有远程主机.git要求每个远程主机都必须指定主机名。origin远程主机
之前风云有安装一个centos的什么包


参考:http://blog.csdn.net/ithomer/article/details/7529022
 

猜你喜欢

转载自blog.csdn.net/qingyuanluofeng/article/details/88812706