git学习与使用这个就够了

git学习

git代码托管机制

  1. git add . —添加到代码缓存区域
  2. git commit – 提交到代码仓库

git 的常用命令

设置用户签名
git --version
// 查看git 版本号
git config --global user.name OneByOne
// 设置用户信息
git config --global user.email ****@163.com
// 设置用户邮箱

可以本地地用户目录下面看到以.gitconfig的文件查看是否设置(修改)成功
在这里插入图片描述

初始化本地仓库
// 初始化本地库
git init
// Initialized empty Git repository in D:/vueLearning/day07Vuex/.git/

.git 为隐藏文件,但是其实它也不需要进行修改

查看本地库状态
git status

// On branch master 默认分支为master
// No commits yet 还未提交任何内容
// nothing to commit (create/copy files and use "git add" to track) 缓存区域无提交任务
新建一个文件(模拟提交作用)
vim hello.txt
// 创建一个hello.txt文件
// 内容如下
/**
hello git!
hello git!
hello git!
hello git!
hello git!
hello git!
hello git!
hello git!
hello git!
hello git!
hello git!
hello git!
hello git!
hello git!
hello git!
hello git!
hello git!
*
/


相较于之前git status的变化
在这里插入图片描述

添加到暂存区
git add hello.txt
// 提交到暂存区域

// warning: in the working copy of 'hello.txt', LF will be replaced by CRLF the next time Git touches it 
// 无需管理 此warning 警告 其为linux 与 windows 的换行符转化问题

相较于之前git status的变化
在这里插入图片描述

删除暂存区的文件(有的时候上传错误会用到)
git rm --cached hello.txt
  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

aolihui

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值