zoukankan      html  css  js  c++  java
  • git代码管理(2)——git工作流程基本原理

    一、git工作区

    1.在本地git的三个工作区:

    1.1 工作目录(work directory):平时存放代码项目的地方

    1.2 暂存区(stage/index):用于临时存放自己做的改动,以一个文件的形式存放记录,用来保存即将要提交到文件列表的信息

    1.3 资源库(repository或git directory):安全存放数据的位置,有我们提交到所有版本的数据,其中HEAD指向最新放入仓库的版本

          ** 本地的三个区域确切的说应该是git仓库中HEAD指向的版本,HEAD实际是指向 master 分支的一个"游标"

    1.4 如果加上远程git仓库(remote directory):托管代码的服务器,是我们项目组中的一台电脑用于远程数据交换(或则github)

    2. git工作流程:

    1. 在工作目录中添加、修改文件;

    2. 将需要进行版本管理的文件放入暂存区域;

    3. 将暂存区域的文件提交到git仓库

    3. git管理文件的3种状态:

    根据git的工作流,因此文件在不同的工作流中有3种状态:已修改(modified),已暂存(staged),已提交(committed)

    4. git文件的操作:

    # 查看指定文件状态
    git status filename
    # 查看所有文件状态
    git status

     需要执行如下操作:

    $ git add .
    
    $ git commit -m "pull array demo"
    
    $ git status
    On branch master
    Your branch is ahead of 'origin/master' by 1 commit.
      (use "git push" to publish your local commits)
    nothing to commit, working tree clean
    
    $ git push origin master
    Logon failed, use ctrl+c to cancel basic credential prompt.
    Enumerating objects: 56, done.
    Counting objects: 100% (56/56), done.
    Delta compression using up to 4 threads
    Compressing objects: 100% (34/34), done.
    Writing objects: 100% (40/40), 11.68 KiB | 1.17 MiB/s, done.
    Total 40 (delta 6), reused 0 (delta 0), pack-reused 0
    remote: Resolving deltas: 100% (6/6), completed with 4 local objects.
    To https://github.com/Asteven-zn/javaselearn.git
       3df1e03..f8e3ff4  master -> master
    
    $ git status
    On branch master
    Your branch is up to date with 'origin/master'.
    nothing to commit, working tree clean
  • 相关阅读:
    expected type: java.lang.Double, actual value: java.math.BigDecimal
    解压大文件提示C盘空间不足的问题
    typeError: cannot read property '_wrapper' of undefined
    在webwork中格式化货币(带千分位的数值)
    Batch update returned unexpected row count from update [0]; actual row count: 0; expected: 1
    mui返回到顶部
    vue中使用js-xlsx实现前端导入导出功能
    Web Components实践开发Tab组件
    帝王师:张居正——读书笔记
    数学与生活——读书笔记
  • 原文地址:https://www.cnblogs.com/cloudhere/p/14661883.html
Copyright © 2011-2022 走看看