zoukankan      html  css  js  c++  java
  • Git

    工作区:当前开发程序所在目录称为工作区,即工作开发都是在该目录,该区域的文件会有状态的变化且状态由git自动检测,如果程序中文件做任何操作(增、删、改),文件状态均会被检测到,可以使用 git status命令查看。【git init】初始化,表示即将对当前文件夹进行版本控制。
     

    版本库:工作区检测到有文件发生变化,那么意味着较上一个版本之后对程序进行了修改,修改完成之后,可以当做下一版本进行提交,那么就是执行 git add . 将所有文件提交到暂存区,然后再执行git commit -m '又一个版本'提交到版本库的分支即可,之后可以使用git log命令查看

     

    Git下载

    //下载git    brew istall git

    //查看版本   git --version

    修改提交者信息

    //更换提交者姓名  git config --global 'user.name' 'feizisy'

    //更换提交者邮箱  git config --global 'user.email' 'dogandhorse@126.com'

    密钥相关操作

    //进入ssh文件下  cd ~/.ssh

    //打印密钥  cat id_rsa.pub

    git常用命令

    git status   查看文件状态

    git log  查看版本记录

    git init  //初始化

    git clone git@     //从远程仓库克隆代码with ssh

    git clone  https://        //从远程仓库克隆代码with https

    git pull origin master   //从远程仓库拉取分支  

    git  add .  //添加至版本库暂存index 

    git  checkout .  //从版本库暂存index恢复 

    git commit -m "提交说明"  //提交至分支  
    git push origin master  //推送至远程仓库 

    branch常用命令

    git branch 分支名称 //创建分支

    git checkout 分支名称 //切换分支

    git branch -m 分支名称 //创建并切换到指定分支

    git branch //查看所有分支

    git branch -D 分支名称 //删除分支

    git merge 分支名称 //将指定分支合并到当前分支

  • 相关阅读:
    LeetCode 842. Split Array into Fibonacci Sequence
    LeetCode 1087. Brace Expansion
    LeetCode 1219. Path with Maximum Gold
    LeetCode 1079. Letter Tile Possibilities
    LeetCode 1049. Last Stone Weight II
    LeetCode 1046. Last Stone Weight
    LeetCode 1139. Largest 1-Bordered Square
    LeetCode 764. Largest Plus Sign
    LeetCode 1105. Filling Bookcase Shelves
    LeetCode 1027. Longest Arithmetic Sequence
  • 原文地址:https://www.cnblogs.com/feizisy/p/11277805.html
Copyright © 2011-2022 走看看