git

$ git branch newbranch 新建分支
$ git branch 查看分支

  • master newbranch输出
    $ git checkout new branch切换分支
    Switched to branch 'newbranch'输出
    git ls-files查看暂存区
    git commit -m "remove .idea/"删除文件
    git rm -r --cached target 删除target文件夹
    git push origin master推送
    git status查看是否还有文件没有提交
    git reset --hard HEAD^ 回退到上一个
    git reset --hard HEAD~100回退到上一百个
    git reset --hard 版本号
    查看分支:git branch
    创建分支:git branch name
    切换分支:git checkout name
    创建+切换分支:git checkout –b name
    合并某分支到当前分支:git merge name
    删除分支:git branch –d name
    第一步:git init 初始化项目文件夹
    第二步:git add . 键所有文件添加到暂存区
    第三步:git commit -m "first commit" 提交到本地仓库
    第四步:git remote add origin XXX(XXX就是你github或者码云等远程仓库的地址
    信息查看
    git branch这个命令可以看到你所在的分支,

删除

git remote rm origin 删除某个仓库地址使用
第五步:git pull 拉取远程分支信息,首次拉取合并信息
第六步:git push -u -f origin master 提交到远程仓库,这个命令中的 -f 是强制推送,因为远程仓库只有初始化的文件,所以强制推送上去就行了,不加-f 会报当前分支没有远程分支,强制推送可以覆盖master,这样就完成了第一次提交的步骤)
git remote remove origin # 删掉原来git源
git remote add origin [YOUR NEW .GIT URL] # 将新源地址写入本地版本库配置文件

$ git ls-files 查看我的本地库
暂存区域-----提交本地库------同步外库
$ git commit -m '删除了target' 提交,添加操作说明
git push -u origin master # 提交所有代码
git checkout -- <文件名file>丢弃工作区域更改
git status 查询工作区域的状态
clear
rm .git/index
$ git rm --cached readme.txt

一种是 git rm --cached "文件路径",不删除物理文件,仅将该文件从缓存中删除;
一种是 git rm --f "文git rm -- cached "路径+文件名"
git push件路径",不仅将该文件从缓存中删除,还会将物理文件删除(不会回收到垃圾桶)
git rm -- cached "路径+文件名"
git commit -m "delete file"
git push 提交
安装 hexo
npm install -g hexo
创建文件夹
hexo init
安装依赖包
npm install
生成hexo generate
启动服务
Ctrl+c结束运行
初始化: hexo init
添加新文章: hexo n
生成静态页面: hexo g
本地运行: hexo s
部署: hexo d

Git权威指南
http://www.worldhello.net/gotgit/#id9
提交步骤

  1. git init //初始化仓库
  2. git add .(文件name) //添加文件到本地仓库
  3. git commit -m "first commit" //添加文件描述信息
  4. git remote add origin + 远程仓库地址 //链接远程仓库,创建主分支
  5. git pull origin master // 把本地仓库的变化连接到远程仓库主分支
  6. git push -u origin master f //把本地仓库的文件推送到远程仓库 -u记住提交地址分支
    -f覆盖原仓库内容
    git merge user 切换旧的仓库,合并新的仓库

Git checkout -b login 创建并切换分支

原文地址:https://www.cnblogs.com/zong-zong/p/13553417.html