【git学习】git本地的简单使用

安装

  1. 下载地址

  2. 默认安装即可

  3. 打开git bush

  4. 配置信息

    $ git config --global user.name "Your Name"
    $ git config --global user.email "[email protected]"
    

    config 是配置的意思,global是全局的意思
    如果想要获取信息,只需

    $ git config user.name 
    $ git config user.email 
    

初次使用

  • 显示电脑隐藏的文件夹
    在这里插入图片描述
  • 打开需要创建git仓库的位置

在这里插入图片描述

  • git bash here

  • pwd 显示当前目录。

    ls 显示当前目录的文件列表

  • git init

    创建仓库,init可以看成“初始化”

    查看文件夹,会看到 .git文件,默认情况下它是隐藏的,git仓库就在这里,如果删除,所有git信息都会消失

git add与git commit

git add 添加

git commit 提交

提交,正式,结果

添加,日常,过程

git add 加文件名、文件夹名或 . 表示添加全部

git commit -m 加信息 当提交的次数多了的话信息就十分重要

git add .
git commit -m"第一次提交"

注意一定要是英文字符

git status 与git diff

status 状态

diff difference缩写,不同

git status
On branch master
nothing to commit, working tree clean

表示 在主分支,没有需要commit的,工作目录是干净(working tree clean)的。

git diff 按 q 键停止

学习地址

廖雪峰,Git教程
菜鸟教程

发布了136 篇原创文章 · 获赞 18 · 访问量 4175

猜你喜欢

转载自blog.csdn.net/xcdq_aaa/article/details/105144991