一. markdown
1. markdown列表
html是一种发布的格式,markdown是一种书写的格式
- 区块引用
列表
- 图片
表格
- html
标题
- 记笔记
- 写博客
2.markdown链接
1. 行内式
2. 参考式
I get 10 times more traffic from Google than from Yahoo or MSN.
3.markdown强调
强调
强调
强调
强调
4.markdown代码
public static void main(String[] args) {
System.out.println("hello world!");
}
}
5.markdown图片
6.markdown表格
姓名 | 年龄 | 职位 |
---|---|---|
小张 | 28 | 前端 |
小李 | 27 | 后端 |
二.git
1.git安装及基本知识
git是目前最先进的分布式版本控制系统
所有版本管理系统,只能跟踪文本文件的改动(到底改了哪里),对于二进制的改动(图片,视频)无能为力,不能知道具体改动了哪里。Word文档也是二进制。
git 编码最好为utf-8
git 不要使用记事本编辑
勤用help version
下载自动补全脚本上
git分区
工作区:电脑目录
暂存区:.git/index
工作区:.git
安装后的设置
git config --global user.name dengyouquan
git config --global user.email [email protected]
git config --global --list #查看当前用户配置信息
git config --local --list #查看当前仓库配置信息
git config --system --list #查看系统配置
git config -l
git config -h
2.git使用步骤
1.git初始化
git init
2. git添加文件(工作区->暂存区)
git add 文件名
- git add . : 提交被修改(modified)和新文件(new),不提交被删除(deleted)
- git add -A :提交所有变化
- git add -u :提交被修改(modified)和被删除(deleted),不提交新文件(new)'
3.git提交文件(暂存区->版本库)
git commit -m "message"
4.git提交到远程库(版本库->远程版本库)
git remote add origin [email protected]:dengyouquan/test.git#关联版本库
git push -u origin master # (第一次推送)
git push origin master #(以后的推送)
3.git还原
基础命令
git status:仓库状态
git diff 文件名#比较文件
git log #查看提交历史
git reset --hard 版本号#版本回退
git reflog#查看命令历史
修改还原
撤销工作区修改:git checkout -- 文件名
撤销暂存区修改:git reset HEAD 文件名(撤销后文件在工作区,如需完全撤销,执行git checkout -- 文件名)
撤销版本库修改:git reset --hard commit_id回退版本库
推送到远程版本库:无法撤销修改
删除还原
git add test
git commit test
rm test
版本库误删:git checkout -- test
版本库正删:git rm test
4.git远程使用
生成SSH密钥
ssh-keygen -t rsa -C [email protected]
其他命令
git clone [email protected]:dengyouquan/test.git #克隆master
git clone [email protected]:dengyouquan/test.git #克隆分支
5.git分支
git checkout -b 分支名 #创建并且切换分支
git branch 分支名 #创建分支
git checout 分支名 #切换分支
git branch #查看当前分支
git merge 分支名 #合并分支
git branch -d 分支名 #删除分支
git pull 远程主机名 远程分支名:本地分支名
git pull 远程主机名 分支名 #远程分支名和本地分支名一样可省略
git fetch origin
git merage origin/next
git clone [email protected]:dengyouquan/test.git
git checkout -b develop origin/develop
6.git冲突
git log --graph --pretty=oneline --abbrev-commit #用带参数的 git log 也可以看到分⽀支的合并情况
git merge --no-ff -m "禁⽤Fastforward" 分支名 #普通模式合并,能看出来曾经做过合并,fast forward看不出来
git branch -D 分支名 #丢弃一个没有被合并过的分支,强行删除
git remote -v
git remote remove 分支名
7.git stash
当手头工作没有完成时,先把工作现场 git stash 一下,然后去修复bug,修复后,再 git stash pop ,回到工作现场。
存储当前分支
git stash
查看储存分支
git stash list
恢复不删除
git stash apply [stash名]
恢复删除
git stash pop
删除stash
git stash drop [stash名]
8.git标签
标签也是版本库的一个快照
Git的标签虽然是版本库的快照,但其实它就是指向某个commit的指针(分⽀支可以移动,标签不能移动),所以,创建和删除标签都是瞬间完成的。
git tag 标签名 [commit_id]
git tag -d #标签名:删除标签名
git tag #查看所有标签
git show 标签名 #查看标签信息
git tag -a 标签名 -m 说明⽂文字 commit_id
- 命令 git push origin tagname #可以推送一个本地标签;
- 命令 git push origin --tags #可以推送全部未推送过的本地标签;
- 命令 git tag -d tagname #可以删除一个本地标签;
- 命令 git push origin :refs/tags/tagname #可以删除一个远程标签。
9.git多人协作
- 首先,可以试图用 git push origin branch-name 推送自己的修改;
- 如果推送失败,则因为远程分支比你的本地更新,需要先用 git pull 试图合并;
- 如果合并有冲突,则解决冲突,并在本地提交;
- 没有冲突或者解决掉冲突后,再用 git push origin branch-name 推送就能成功!
在本地创建和远程分支对应的分支,使用 git checkout -b branch-name origin/branch-name ,本地和远程分支的名称最好一致;
建立本地分支和远程分支的关联,使用 git branch --set-upstream branch-name origin/branch-name;
10.git配置别名
git config --global alias.unstage 'reset HEAD'
git unstage test.py 等同于 git reset HEAD test.py
git config --global alias.lg "log --graph --pretty=oneline --abbrev-commit"
11.培训老师讲解
知识点
.git的内容
README.md叙述一定要清楚正确
gitnore(target不能发,太大)
gitmodules
gitlab-ci.yml .circleci
查找资料优先级:官网->Google->百度
ci:持续集成(Continuous integration),cd:持续部署()
https ssh(git 用https push)
GitFlow
课后作业
- github账号
- 创建子模块库+ 父模块库 ,给出父模块地址
git提交
- 新建自己分支20631
- 去develop分支git pull
- 去20631分支git merge
- git push上传