初学Git --1

前言

  • 记录时间:2020.2.7
  • 教程来源:https://www.bilibili.com/video/av10475153?p=8
  • 由于没有linux基础,所以记的部分内容很小白,配合视频食用更香。(不是广告只是建议)

流程

1. 新建文件夹工作区

2. 初始化Git仓库

工作区
暂存区
git status //查看当前状态
git add hello.php
git add test.php
  • 工作区 Working Directory:hello.php test.php
  • 暂存区:hello.php test.php

3. 操作Git仓库

暂存区
本地Git仓库
git status
git commit -m "提交描述"
  • Git 仓库 Git Repository

4. 上传至GitHub

本地仓库
远程仓库
push git

具体

创建文件夹(工作区域)

0. 备注

makdir demo1 //创建一个名为demo1的文件夹
  • pwd 当前目录
  • cd 进入地址
  • ls -ah 查看隐藏目录

1. 设置用户名

git config --global user.name'hyidol'
  • config 配置
  • global 全局

2. 设置用户名邮箱

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

3. 查看设置

git config -list

向仓库添加文件

0. 备注

cd test
git init

1. 创建文件

touch a1.php //添加
rm -rf //删除

2. 把文件传到暂存区

git add a1.php

3. 把暂存区文件上传

git commit -m 'add a1.php' //添加描述
git status //显示:nothing to commit,working directory clean

修改仓库文件

1.
vi a1.php //回车后键入修改的部分 同vim。键入后需要点击a 才能进入type模式,退出先摁Esc,再键入:wq(或shift+zz)
//GUN nano //比vi vim新,推荐
cat a1.php //查看修改的内容

2.
git commit -m '第一次通过git修改文件并提交到仓库'
git status //验证提交成功
  • wq:wave quit 保存

删除仓库文件

总结

在这里插入图片描述

发布了19 篇原创文章 · 获赞 0 · 访问量 2000

猜你喜欢

转载自blog.csdn.net/hyidol/article/details/104218598