0


Git简介

文章目录

Git是什么?

Git是我们的

代码管理工具

,是一个

代码仓库

,让我们存储代码的。

安装Git

官网:https://git-scm.com/
(傻瓜式安装)检测是否安装成功
命令行输入

git -v

出现版本号就是安装成功
在这里插入图片描述

使用git

配置个人标识

配置名字

git config --global user.name "xingxing"

配置邮箱

git config --global user.email "[email protected]"

查看当前文件状态

git status

初始化

git init

在这里插入图片描述

文件状态

  • 未跟踪
  • 已跟踪 - 未修改- 已修改- 暂存- 放入git仓库 已跟踪状态的文件按照1,2,3,4,1,2,3的顺序进行

状态变化

1.新建文本(未跟踪)
在这里插入图片描述

在这里插入图片描述
2.使用命令git add 文件路径(未跟踪->暂存)
在这里插入图片描述

git commit 将暂存的文件存储到仓库
3.git commit -m “它是一个试验文件”(暂存->未修改)
在这里插入图片描述
我们使用git就是操作文件不同的状态
4.未修改->已修改
修改文件内容的话,文件状态就变为已修改。
已修改
5.已修改->暂存
在这里插入图片描述
6.暂存->未修改
在这里插入图片描述
git log(打印每次修改的记录)
在这里插入图片描述
将所有已修改/未跟踪的文件都变成暂存

git add *

提交所有已修改的文件(未跟踪的文件不会提交)

git commit -a -m “全部提交”

#mermaid-svg-bwNV65soL4FL8tiI {font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:16px;fill:#333;}#mermaid-svg-bwNV65soL4FL8tiI .error-icon{fill:#552222;}#mermaid-svg-bwNV65soL4FL8tiI .error-text{fill:#552222;stroke:#552222;}#mermaid-svg-bwNV65soL4FL8tiI .edge-thickness-normal{stroke-width:2px;}#mermaid-svg-bwNV65soL4FL8tiI .edge-thickness-thick{stroke-width:3.5px;}#mermaid-svg-bwNV65soL4FL8tiI .edge-pattern-solid{stroke-dasharray:0;}#mermaid-svg-bwNV65soL4FL8tiI .edge-pattern-dashed{stroke-dasharray:3;}#mermaid-svg-bwNV65soL4FL8tiI .edge-pattern-dotted{stroke-dasharray:2;}#mermaid-svg-bwNV65soL4FL8tiI .marker{fill:#333333;stroke:#333333;}#mermaid-svg-bwNV65soL4FL8tiI .marker.cross{stroke:#333333;}#mermaid-svg-bwNV65soL4FL8tiI svg{font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:16px;}#mermaid-svg-bwNV65soL4FL8tiI .label{font-family:"trebuchet ms",verdana,arial,sans-serif;color:#333;}#mermaid-svg-bwNV65soL4FL8tiI .cluster-label text{fill:#333;}#mermaid-svg-bwNV65soL4FL8tiI .cluster-label span{color:#333;}#mermaid-svg-bwNV65soL4FL8tiI .label text,#mermaid-svg-bwNV65soL4FL8tiI span{fill:#333;color:#333;}#mermaid-svg-bwNV65soL4FL8tiI .node rect,#mermaid-svg-bwNV65soL4FL8tiI .node circle,#mermaid-svg-bwNV65soL4FL8tiI .node ellipse,#mermaid-svg-bwNV65soL4FL8tiI .node polygon,#mermaid-svg-bwNV65soL4FL8tiI .node path{fill:#ECECFF;stroke:#9370DB;stroke-width:1px;}#mermaid-svg-bwNV65soL4FL8tiI .node .label{text-align:center;}#mermaid-svg-bwNV65soL4FL8tiI .node.clickable{cursor:pointer;}#mermaid-svg-bwNV65soL4FL8tiI .arrowheadPath{fill:#333333;}#mermaid-svg-bwNV65soL4FL8tiI .edgePath .path{stroke:#333333;stroke-width:2.0px;}#mermaid-svg-bwNV65soL4FL8tiI .flowchart-link{stroke:#333333;fill:none;}#mermaid-svg-bwNV65soL4FL8tiI .edgeLabel{background-color:#e8e8e8;text-align:center;}#mermaid-svg-bwNV65soL4FL8tiI .edgeLabel rect{opacity:0.5;background-color:#e8e8e8;fill:#e8e8e8;}#mermaid-svg-bwNV65soL4FL8tiI .cluster rect{fill:#ffffde;stroke:#aaaa33;stroke-width:1px;}#mermaid-svg-bwNV65soL4FL8tiI .cluster text{fill:#333;}#mermaid-svg-bwNV65soL4FL8tiI .cluster span{color:#333;}#mermaid-svg-bwNV65soL4FL8tiI div.mermaidTooltip{position:absolute;text-align:center;max-width:200px;padding:2px;font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:12px;background:hsl(80, 100%, 96.2745098039%);border:1px solid #aaaa33;border-radius:2px;pointer-events:none;z-index:100;}#mermaid-svg-bwNV65soL4FL8tiI :root{--mermaid-font-family:"trebuchet ms",verdana,arial,sans-serif;}

       初始化 
     

       未追踪 
     

       暂存 
     

       提交入库 
     

       未修改 
     

       已修改 
     

汇总常用命令

命令作用git -v查看git版本号git config --global user.name “xingxing”配置姓名git config --global user.email “2466530844@qq.com”配置邮箱git status查看文件状态git init初始化git add 文件路径未追踪->暂存git commit -m “”暂存->提交git log打印每次修改的记录git add *所有未追踪/已修改->暂存git commit -a -m “”所有未修改->提交

标签: git

本文转载自: https://blog.csdn.net/jkjkikik/article/details/137241315
版权归原作者 司篂篂 所有, 如有侵权,请联系我们删除。

“Git简介”的评论:

还没有评论