• git


    工作区:      当前的编辑位置

    缓存区:      add 之后的区域

    版本库:      commit之后的区域就是版本库

    git init .         初始化

    git add .       将工作区的所有文件添加到缓存区

    git commit -m “提交信息” 将缓存区的内容添加到版本库

    git status     查看当前的状态

    git reset --hard hash值   回退到指定的版本

    git checkout -- file           将文件回滚到最近一次提交的样子

    git log                             查看当前位置之前的提交记录

    git reflog                         查看所有的记录

    git reset head file           将缓存区的文件拉取到工作区

    git diff                             对比工作区和缓存区

    git diff --cached              对比版本库和缓存区

    快照 :

    git stash 将当前的内容做快照,并回到最后一次提交的位置

    git stash list 查看快照列表

    git stash pop 回到快照位置,并删除这个快照

    git stash drop 删除快照

    git stash apply 回到快照

    分支 :

    git branch 查看分支列表

    git branch name 创建分支

    git checkout name 切换分支

    git checkout -b name 创建分支并切换分支

    git branch -d name 删除分支

    git merge name 在合并到的分支上进行合并

    标签 :

    - git tag                   查看所有标签
    - git tag -a v1.0 -m "v1.0"  创建标签
    - git tag -d               删除本地标签
    - git push origin :refs/tags/v1.0  删除远程仓库标签
    - git push origin --tags  上传所有标签

    忽略文件 :

    - .gitignore

  • 相关阅读:
    100-days: twelve
    100-days: eleven
    100-days: ten
    [PKUWC 2018]随机算法
    [CTSC 2018]假面
    APIO 2018 游记
    CTSC 2018 游记
    [CQOI 2018]解锁屏幕
    [CQOI 2018]九连环
    [CQOI 2018]破解D-H协议
  • 原文地址:https://www.cnblogs.com/zhaoyang110/p/12143480.html
Copyright © 2020-2023  润新知