库管理

作者: lwwlsky | 来源:发表于2016-06-19 21:41 被阅读17次

库管理

克隆库

git clone https://github.com/php/php-src.git
git clone --depth=1 https://github.com/php/php-src.git # 只抓取最近的一次 commit
历史管理

查看历史

git log --pretty=oneline filename # 一行显示
git show xxxx # 查看某次修改
标签功能

git tag # 显示所有标签
git tag -l 'v1.4.2.*' # 显示 1.4.2 开头标签
git tag v1.3 # 简单打标签
git tag -a v1.2 9fceb02 # 后期加注标签
git tag -a v1.4 -m 'my version 1.4' # 增加标签并注释, -a 为 annotated 缩写
git show v1.4 # 看某一标签详情
git push origin v1.5 # 分享某个标签
git push origin --tags # 分享所有标签
回滚操作

git reset 9fceb02 # 保留修改
git reset 9fceb02 --hard # 删除之后的修改
取消文件的修改

git checkout -- a.php # 取消单个文件
git checkout -- # 取消所有文件的修改
删除文件

git rm a.php # 直接删除文件
git rm --cached a.php # 删除文件暂存状态
移动文件

git mv a.php ./test/a.php
查看文件修改

git diff # 查看未暂存的文件更新
git diff --cached # 查看已暂存文件的更新
暂存和恢复当前staging

git stash # 暂存当前分支的修改
git stash apply # 恢复最近一次暂存
git stash list # 查看暂存内容
git stash apply stash@{2} # 指定恢复某次暂存内容
git stash drop stash@{0} # 删除某次暂存内容
修改 commit 历史纪录

git rebase -i 0580eab8
分支管理

创建分支

git branch develop # 只创建分支
git checkout -b master develop # 创建并切换到 develop 分支
合并分支

git checkout master # 切换到 master 分支
git merge --no-ff develop # 把 develop 合并到 master 分支,no-ff 选项的作用是保留原分支记录
git rebase develop # rebase 当前分支到 develop
git branch -d develop # 删除 develop 分支
克隆远程分支

git branch -r # 显示所有分支,包含远程分支
git checkout origin/android
修复develop上的合并错误

将merge前的commit创建一个分之,保留merge后代码
将develop reset --force到merge前,然后push --force
在分支中rebase develop
将分支push到服务器上重新merge
强制更新到远程分支最新版本

git reset --hard origin/master
git submodule update --remote -f
Submodule使用

克隆带submodule的库

git clone --recursive https://github.com/chaconinc/MainProject
clone主库后再去clone submodule

git clone https://github.com/chaconinc/MainProject
git submodule init
git submodule update
Git设置

Git的全局设置在~/.gitconfig中,单独设置在project/.git/config下。

忽略设置全局在~/.gitignore_global中,单独设置在project/.gitignore下。

设置 commit 的用户和邮箱

git config user.name "xx"
git config user.email "xx@xx.com"
或者直接修改config文件

[user]
name = xxx
email = xxx@xxx.com
查看设置项

git config --list
设置git终端颜色

git config --global color.diff auto
git config --global color.status auto
git config --global color.branch auto

相关文章

  • Mysql_1 数据库基础

    目录:数据库基本知识数据库管理系统 一、数据库基本知识 数据库系统由数据库、数据库管理系统、应用系统和数据库管理员...

  • Chapter 12 .库和表的管理

    阅读原文 Chapter 12 .库和表的管理 DDL /* 数据定义语言 库和表的管理 一、库的管理 创建、修改...

  • 23-MYSQL数据库(一)

    本章内容 数据的时代 数据库的发展史 数据库管理系统 数据库管理系统的优点 文件管理系统的缺点 数据库管理系统的基...

  • day02 体系结构与管理

    数据库逻辑结构 库:库属性表 二、基础管理 2.1、用户管理 2.1.1用户作用: 1.登录2.管理数据库对象 2...

  • mysql相关知识点

    数据库可能会考的题目1、数据库和数据库管理系统之间的关系?数据库:存储,维护和管理数据的集合数据库管理系统:其实就...

  • MYSQL SQL 语句

    基础sql语句 库管理 表管理 用户管理:

  • JavaGuide知识点整理——数据库基础知识总结

    什么是数据库,数据库管理系统,数据库系统,数据库管理员? 数据库:数据库(DataBase 简称DB)就是信息的集...

  • PHP之Mysql 编程一(数据库的基本操作)

    数据库系统: 数据库系统=管理数据的工具(数据库管理系统DBMS(DataBaseManagementSystem...

  • Python -- 图片转字符画

    首先导入必要的库,argparse 库是用来管理命令行参数输入的 首先导入必要的库,argparse 库是用来管理...

  • MySQL零基础入门之从青铜到钻石

    2.5 数据库管理系统、数据库和表的关系 数据库管理系统(DataBase Management System,D...

网友评论

      本文标题:库管理

      本文链接:https://www.haomeiwen.com/subject/djzudttx.html