zoukankan      html  css  js  c++  java
  • 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 在合并到的分支上进行合并

    冲突

    Auto-merging templates/index.html
    CONFLICT (content): Merge conflict in templates/index.html
    The stash entry is kept in case you need it again.

    手动解决

    远程仓库

    git clone 默认master分支

    git checkout -b dev origin/dev  取出分支

    git push origin  dev 将本地分支推送到远程仓库

    git pull   拉取代码

    git remote add origin https://url.git 创建别名

    给别人贡献代码

    先 fork 

    在本地修改

    new  pull  request    等待对方是否采取

    标签(版本信息

    git tag 

    git tag -a v1.0 -m “信息”

    git tag -d 删除

    git push origin --tag

    git push origin :refs/tags/v1.0

    忽略文件

    .gitignore

    gitlab 公司私有 (一般都是这种公司搭建的)

  • 相关阅读:
    打开模拟器genymotion 的设置 查询设置的包名
    python 地板除 向下取整 取比目标结果小的的最大整数
    python 复数
    python 0.1+0.2 不等于0.3 的处理办法
    python 利用随机数的种子,复现随机数
    小程序 单独页面的js文件里设置 数据绑定
    问题集
    2020软件工程个人作业06——软件工程实践总结作业
    2020软件工程作业05
    2020软件工程作业04
  • 原文地址:https://www.cnblogs.com/Wj-Li/p/10864897.html
Copyright © 2011-2022 走看看