OpenStack git cmd

文件流转的三个工作区域: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的更多相关文章
- 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 ...
- [Git]2018-10 解决git cmd中文乱码问题
2018年10月12日 莫名其妙出现cmd下git log中文乱码问题,显示一堆<E4><A8>之类的乱码.git bash却一切正常. 怀疑是Windows系统升级出现的不兼 ...
- Git CMD - config: Get and set repository or global options
命令参数 --get 获取指定的配置项. --global 对于写选项:全局配置,将参数配置于 ~/.gitconfig 而不是仓库目录下的 .git/config.对于读选项:只从 ~/.gitco ...
- 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 ...
- Git CMD - clone: Clone a repository into a new directory
命令格式 git clone [--template=<template_directory>] [-l] [-s] [--no-hardlinks] [-q] [-n] [--bare ...
- Git CMD - add: Add file contents to the index
命令格式 git add [--verbose | -v] [--dry-run | -n] [--force | -f] [--interactive | -i] [--patch | -p] [- ...
- Git CMD - status: Show the working tree status
命令参数 git status [<options>…] [--] [<pathspec>…] 命令格式 --short, -s 短格式输出. -- long 长格式输出, ...
- Git CMD - diff: Show changes between commits, commit and working tree, etc
命令格式 git diff [options] [<commit>] [--] [<path>…] git diff [options] --cached [<comm ...
- Git CMD - add: Record changes to the repository
命令格式 git commit [-a | --interactive | --patch] [-s] [-v] [-u<mode>] [--amend] [--dry-run] [(-c ...
随机推荐
- 不卸载ceph重新获取一个干净的集群环境
不卸载ceph重新获取一个干净的集群环境 标签(空格分隔): ceph ceph环境搭建 运维 部署了一个ceph集群环境,由于种种原因需要回到最开始完全clean的状态,而又不想卸载ceph客户端或 ...
- 通过pip3安装ipython
操作系统:Centos7.4:ipython可以用来测试python语句,故需要安装. 首先需要安装epelde的扩展库: easy_install是由PEAK(Python Enterprise A ...
- java基础知识(9)---异常
异 常: 异常:就是不正常.程序在运行时出现的不正常情况.其实就是程序中出现的问题.这个问题按照面向对象思想进行描述,并封装成了对象.因为问题的产生有产生的原因.有问题的名称.有问题的描述等多个属性信 ...
- BackgroundWorker 控件
BackgroundWorker是.net里用来执行多线程任务的控件,它允许编程者在一个单独的线程上执行一些操作.耗时的操作(如下载和数据库事务)在长时间运行时可能会导致用户界面 (UI) 始终处于停 ...
- jquery插件开发常用总结一
由于使用jquery插件后当form表单提交的时候,若发生错误,同时有验证错误文本时,即使用rules和message后,会自动生成一个label标签里面装有错误文件值. 我们可以替换它: 方式为:v ...
- 同名项目复制,发布新项目,提示已存在该项目于webapp
来自为知笔记(Wiz)
- [nowCoder] 两个长度相同有序数组的中位数
给定两个有序数组arr1和arr2,两个数组长度都为N,求两个数组中所有数的上中位数.例如:arr1 = {1,2,3,4};arr2 = {3,4,5,6};一共8个数则上中位数是第4个数,所以返回 ...
- mongodb-help功能
mongo-help功能 version:2.6.12下面是示例: > help db.help() help on db methods db.m ...
- bos物流面试题
BOS物流项目问题汇总 1 请描述一下这个系 统? 从两个方面回答, 第一个方面:系统背景及系统概述 本系统是基于B/S架构而设计开发的,是某物流公司的一个后台管理系统,属于物流公司整个ERP平台的一 ...
- DropDownList绑定数据库
this.DropDownList_设备列表.DataSource = dt_eq;//设置数据源 this.DropDownList_设备列表.DataTextField = "equip ...