文件流转的三个工作区域:Git 的工作目录,暂存区域,以及本地仓库。

基本的 Git 工作流程如下:

  • 在工作目录中修改某些文件。
  • 对修改后的文件进行快照,然后保存到暂存区域。
  • 提交更新,将保存在暂存区域的文件快照永久转储到 Git 目录中。

1.安装git和git-review

apt-get install git

apt-get install git-review

2.创建分支

建立分支是你创建代码的独立版本的动作,独立于你的主干分支。默认地,每次你提交到Git的文件都会被储存到“master(主干)”分支。
现在我们来说说,你想要向项目里添加一个功能,但你想要能够回滚到现在版本,以防出现差错,或者你决定要放弃这个功能。这就是你创建分支的时候了。

创建并同时切换到你新建的分支命令:

  git checkout -b new_feature

或者,你可以先创建一个分支然后手动切换:

  git branch new_feature

   git checkout new_feature

3.查看当前branch状态

  git status

4.添加当前branch的代码修改到本地暂存区域

  git add *

  git add .

5.查看版本的log记录

  git log

6.查看git的配置

git config --list

git config -l

user.name=xiangxinyong
user.email=xiangxinyong@huawei.com
core.repositoryformatversion=0
core.filemode=true
core.bare=false
core.logallrefupdates=true
remote.origin.url=https://git.openstack.org/openstack/murano
remote.origin.fetch=+refs/heads/*:refs/remotes/origin/*
branch.master.remote=origin
branch.master.merge=refs/heads/master
remote.gerrit.url=https://xianxinyong:CPhXYJBLzg6u@review.openstack.org/openstack/murano.git
remote.gerrit.fetch=+refs/heads/*:refs/remotes/gerrit/*

7.修改git配置项

git config --global user.name xiangxinyong

8.添加或修改git的message

添加:git commit -a -F .git/message  

修改:git commit --amend -a -F .git/message

9.添加和设置gerrit(可选)

  当端口29418被封的时候需要按以下步骤设置:

首先,需要登录review.openstack.org,然后在Settings -> HTTP Password里,生成一个HTTP密码,应该是一个大小写加数字的随机字符串。

git remote set-url gerrit https://username:http-password@review.openstack.org/openstack/nova.git命令把ssh修改成https方式,当然也可以用http

git remote add gerrit https://username:http-password@review.openstack.org/openstack/nova.git

备注:上面字符串中的用户名/密码改成你的gerrit用户名和上一步生成的HTTP密码。

10.提交代码到远程代码库

  git review

Else:

(1)git diff 查看本地修改的具体内容

(2)git branch -d branchname 删除本地分支

(3)git checkout . 取消本地所有修改

(4)git pull https://git.openstack.org/openstack/murano 获取最新代码

(5)git rebase -i 本地重新建立依赖关系,删除掉所有的依赖描述,只保留当前patch的描述,

Ctrl+X,Y, Enter.

(6)git review -d 1111 获取指定的远程版本

  (7)git show-ref YOUR_TAG

(8)refs/heads/stable/mitaka表示本地分支

(9)refs/remotes/origin/stable/mitaka使用git checkout stable/mitaka

(10)refs/tags/kilo-eol使用git checkout -b stable/kilo kilo-eol

TryStack国内镜像站:

OpenStack git cmd的更多相关文章

  1. Git GUI,Git Bash,Git CMD之间的区别

    Git GUI,Git Bash,Git CMD之间的区别 Git Bash: Bash,Unix shell的一种,Linux与Mac OS X v10.4都将它作为默认shell.Git Bash ...

  2. [Git]2018-10 解决git cmd中文乱码问题

    2018年10月12日 莫名其妙出现cmd下git log中文乱码问题,显示一堆<E4><A8>之类的乱码.git bash却一切正常. 怀疑是Windows系统升级出现的不兼 ...

  3. Git CMD - config: Get and set repository or global options

    命令参数 --get 获取指定的配置项. --global 对于写选项:全局配置,将参数配置于 ~/.gitconfig 而不是仓库目录下的 .git/config.对于读选项:只从 ~/.gitco ...

  4. Git CMD - init: Create an empty Git repository or reinitialize an existing one

    命令格式 git init [-q | --quiet] [--bare] [--template=<template_directory>] [--separate-git-dir &l ...

  5. Git CMD - clone: Clone a repository into a new directory

    命令格式 git clone [--template=<template_directory>]  [-l] [-s] [--no-hardlinks] [-q] [-n] [--bare ...

  6. Git CMD - add: Add file contents to the index

    命令格式 git add [--verbose | -v] [--dry-run | -n] [--force | -f] [--interactive | -i] [--patch | -p] [- ...

  7. Git CMD - status: Show the working tree status

    命令参数 git status [<options>…​] [--] [<pathspec>…​] 命令格式 --short, -s 短格式输出. -- long 长格式输出, ...

  8. Git CMD - diff: Show changes between commits, commit and working tree, etc

    命令格式 git diff [options] [<commit>] [--] [<path>…​] git diff [options] --cached [<comm ...

  9. Git CMD - add: Record changes to the repository

    命令格式 git commit [-a | --interactive | --patch] [-s] [-v] [-u<mode>] [--amend] [--dry-run] [(-c ...

随机推荐

  1. 【转】 Pro Android学习笔记(七九):服务(4):远程服务的实现

    目录(?)[-] 远程服务的实现小例子 对外开放远程服务的接口 文章转载只能用于非商业性质,且不能带有虚拟货币.积分.注册等附加条件.转载须注明出处:http://blog.csdn.net/flow ...

  2. Python知识点:distutils常用子模块

    from distutils.core import setup, Extension, Commandfrom distutils.command.build import buildfrom di ...

  3. 文件异步上传,多文件上传插件uploadify

    本文中使用java作为例子 uploadify下载 http://files.cnblogs.com/chyg/uploadify.zip jsp页面中需要引入: <script type=&q ...

  4. BluetoothFindRadioClose 函数

    BOOL BluetoothFindRadioClose( HBLUETOOTH_RADIO_FIND hFind );关闭与查找蓝牙无线电相关的枚举句柄.参数: hFind Enumeration ...

  5. java不定参数列表---乔老师没讲,但是传智有讲

    **public static void sum(int i,int...srgs){** package com.xml; public class dremo1 { public static v ...

  6. Matlab数据类型的转换

    Matlab中有15种基本数据类型,主要是整型.浮点.逻辑.字符.日期和时间.结构数组.单元格数组以及函数句柄等. 1.整型:(int8:uint8:int16:uint16:int32:uint32 ...

  7. [codeforces821E]Okabe and El Psy Kongroo

    题意:(0,0)走到(k,0),每一部分有一条线段作为上界,求方案数. 解题关键:dp+矩阵快速幂,盗个图,注意ll 关于那条语句为什么不加也可以,因为我的矩阵C,就是因为多传了了len的原因,其他位 ...

  8. 10.Ubuntu16搭建蜜罐Cowrie

    一直都想尝试搭建一个蜜罐,因为蜜罐是一款可以对ssh,telnet,http等等协议攻击进行记录,对于输入命令和上传文件均有记录的一款软件. 记录可以设置在日志文件中或者通过配置数据库,导入数据库中方 ...

  9. 24.command-executor

    这里先给出题目链接: https://command-executor.hackme.inndy.tw/ 这是一道不错的ctf题,首先说一下考察点: 文件包含读源码 代码分析结合CVE CVE导致的命 ...

  10. 日记(18)-20141008---PHP是做什么的

    1,PHP 是一种用来制作动态网页的服务器端脚本语言.2,因为PHP脚本是写在 HTML 文档中的,你不必用特殊的编辑器来创建页面.3,php 是一种服务器端的脚本语言,一般用来做网站. (感言,我太 ...