4

Git是什么?Git基本命令+工作区命令

 2 years ago
source link: https://segmentfault.com/a/1190000041049083
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

Git是什么?Git基本命令+工作区命令

git是什么?

git是目前世界上最先进的分布式版本控制系统(没有之一),Git是一个开源的分布式版本控制系统,可以有效、高速地处理从很小到非常大的项目版本管理。

  1. git是什么
  2. git指令

    • git基本命令
    • git 四大工作区命令
    • git 查看config配置

在学习git指令之前, 我们可以先在D盘创建一个文件夹 gitcode 创建后在文件下右键打开 Git Bash Here 就可以进入接下来的学习了!

git指令

cd .. :退一步当前文件(cd需要空格)

cd .. 

cd 选择的文件 :进去一个文件

cd gitcode 

pwd :显示当前路径

pwd

ls(ll) :显示所有文件 ll :可以看到更多

ls / ll

touch 文件名+后缀 :新建一个文件

touch test.html 

rm 删除的文件 : 删除文件

rm test.html 

mkdir 文件夹名 :新建一个文件夹

mkdir div 

help:帮助文档

help 

exit :退出

exit 

git命令

git 四大工作区

工作目录: - >add - > 暂存区 -> commit -> 资源区 -> push 远程仓库

$ git init // 初始化一个git仓库
$ git status // 跟踪文件 
$ git add "文件" // 将文件添加到 暂存区
$ git commit -m "" // 将文件添加到资源库(本地仓库)

git-查看config配置信息

config 配置有system(系统)级别 global(用户级别)

local (当前仓库).三个设置 先从 system > global > local

底层设置会覆盖顶层配置, 可以分别使用 system-global-local定位到配置文件

config 配置指令:

git config

查看系统config

git config --system --list

查看当前用户 (global) 配置

git config --global --list

查看当前仓库配置信息

git config --local --list

设置 username

git config --global user.name "用户名" <- 自己取
如: git config --global user.name "myname"

设置 user.email

git config --global user.email "[email protected]"  <- 自己常用的邮箱
git config --global user.email "[email protected]"

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK