git 的详细教程

1.下载git

​下载地址​

git 的详细教程_ide

2.安装


无脑安装,全部都是下一步。
git 的详细教程_github_02


3.掌握常用的linux命令


git 的详细教程_github_03
git 的详细教程_ide_04


4.git相关配置

4.1 查看相关配置


git config -l
git 的详细教程_ide_05


4.2用户配置


git config --global “你自己的用户名”
git config --global user.email “你的邮箱
git 的详细教程_github_06


5.git的工作流程

1.在工作目录中添加和修改文件。

2.将需要进行管理的文件放到暂存区。

3.将暂存区的文件提交到git。

因此git管理文件有三种状态 已修改(modified),以暂存(staged),已提交(committed)

6.git项目的创建

6.1 本地仓库创建

​git init​

git 的详细教程_暂存区_07

6.2 克隆远程仓库

​git clone url(gitee or github 的代码地址)​

7.git 命令的基本使用

7.1 基本使用

#1.查看指定文件的状态 
git status [filename]
#查看所有文件的状态
git status
#添加文件到暂存区
git add .
#提交暂存区的内容到本地仓库
git commit -m "消息内容"

7.2 上传需要忽略的文件

git 的详细教程_暂存区_08

*.class
*.log
*.lock

# package Files #
*.jar
*.war
*.ear
target/

#idea
.idea/
*.iml

*velocity.log*

### STS ###
.apt_generated
.factorypath
.springBeans

### IntelliJ IDEA ###
*.iml
*.ipr
*.iws
.idea
.classpath
.project
.settings/
bin/

*.log
tmp/

#rebel
*rebel.xml*

8.创建仓库以及配置SSH公钥

8.1 配置公钥


git 的详细教程_github_09
​ssh-keygen -t rsa​git 的详细教程_github_10
git 的详细教程_git_11
git 的详细教程_暂存区_12


8.2 新建仓库


git 的详细教程_github_13


8.3 连接仓库到本地


git 的详细教程_git_14


9.idea 中集成git操作

9.1idea 绑定git


把远程的项目拷贝到自己的项目中git 的详细教程_github_15git 的详细教程_ide_16


9.2 操作文件


git 的详细教程_暂存区_17
git 的详细教程_暂存区_18


9.3 发布测试


git 的详细教程_github_19
git 的详细教程_git_20


10.git 中的分支

#1.查看所有的分支
git branch

#查看远程分支
git branch -r

#新建一个分支,但依旧留在当前分支
git branch [branch-name]

#新建一个分支并且切换
git branch -b [branch-name]

#删除分支
git branch -d [branch-name]

#删除远程分支
git push origin --delete [branch-name]
git branch -dr [remote/branch]

​记得点赞哦​

git 的详细教程_ide_21