- git官网地址:https://git-scm.com/
- verson control system
Version control is a system that records changes to a file or set of files over time so that you can recall specific versions later.
记录文件变化的 并且 之后可以指定版本进行恢复- 论文
- xxx_v1.doc
- xxx_v2.doc
.... - xxx_最终版.doc
- 种类
- Local Version Control Systems: copy files into another directory
- 优点:so simple
- 缺点: error prone (代码集成效率低下)
- Centralized Version Control Systems 集中式版本控制系统:
- 解决: 代码集成效率低下 多人协同开发的问题
- 问题: single point 单点故障
- Distributed Version Control Systems:
解决: 多人协同开发 单点故障- clients
- server
- Local Version Control Systems: copy files into another directory
- 论文
- git
- efficiency
- performance
- 分支操作、文件配置、定制工作流程
- 文件版本控制
- 本地仓库
- 远程仓库
- 部署
- 下载
- 安装
- 使用
- git软件工具
- 可视化界面的方式进行操作:git原理
- git命令操作 == 和linux命令差不多
linux和git都是林纳斯发明的
- git软件工具
- git命令
- 查看git版本
- $ git -v
git version 2.38.1.windows.1
使用前的配置--要配置我们的项目开发人员的信息
& git config --global user.name "yaoyuzhe"
& git config --global user.email "yaoyuzhe@qq.com"
- $ git -v
- 查看git版本
- Config file locatin
- --global use global config file :对当前用户 所有仓库有效
- --system use system config file :对系统所有登陆用户有效
- --local use repository config file :对某个仓库有效 【优先级最高】
- 查看配置参数
- git config --list
- git config --list --global
- git config --list --local
- 创建仓库
- 项目:开发的代码文件
- 仓库:本地仓库 用于进行文件的版本控制的
- git init:
- 创建一个仓库
- 重新初始化一个 以及存在的仓库
git init [-q | --quiet] [--bare] [--template=<template-directory>]
[--separate-git-dir <git-dir>] [--object-format=<format>]
[-b <branch-name> | --initial-branch=<branch-name>]
[--shared[=<permissions>]] [<directory>]
git init [<directory>]
- 项目
- 存在
- cd 项目目录
- git init
- 不存在
- git init <project_name>
- git init test01
- 存在
- 使用
git 管理版本控制的工作流程- 工作区: 项目目录
- 暂存区: 临时存储文件的地方 可以进行撤回
- 本地仓库:版本控制
- 入门
- vim 1.log
- git add 1.log :添加到缓存区
- git commit -m "Add 1.log" :添加到本地仓库
- git log :查看本地仓库历史
- 切换版本
- git reset --hard [<commit>]
- git reset --hard d7db6e
git log --reset :查看以前历史