zoukankan      html  css  js  c++  java
  • git

    git是一款开源的分布式版本控制工具。svn是集中式的。分布式就是服务端和客户端都有一个代码仓库

    git 最快,最简单,最流行的。2005,4月三号到7月,就写完了,(Linux)里拉斯写的

    git svn对比:速度比svn快,svn使用分支比较笨拙,git可以轻松拥有无限个分支,svn必须联网才能工作,git支持本地版本控制工作,svn集中式,git分布式

    svn工作流程,去公司先吧你公司代码下载到你的电脑,后提交到服务器,其他人想要代码,直接update,

    git clone 连仓库一块下载下来,本地也有仓库,编码完后,注意,svn的commit是提交到服务器,git的commit是提交到本地仓库,同步到服务器,就push,其他人想要代码则PULL拉下来

    在mac上,比较好用的git图形界面客户端有:sourceTree,也可以用github,Xcode 也可以,但都是简单操作。比如clone,提交。

    命令行操作git,

    1,新建一个本地仓库,打开终端-cd-manager-pwd-进入经理文件夹,--创建一个本地仓库,git init初始化一个本地仓库回车

    Reinitialized existing Git repository in /Users/andy/Desktop/manager/.git/

    2.配置仓库如果你的电脑从来没有使用过git,你应该告诉git你是谁, git config user.name lnj,告诉git怎么联系你。git config user.email lnj@itcast.cn,上面一种配置方式是一次性配置,会配置到被管理文件的。git文件夹,下面一种配置方式是逸劳永逸的。git config --global user.name lmj  然后 git config user.email lmj@itcast.cn,

    3如何学习git指令和svn学习是一样的,只不过展现的方式不一样,git是通过使用指南的方式告诉我们某个指令如何使用,这个指令其实是不可vim的      

    Q是退出指南。按空格是下一页 control +8 上一页  /需要搜索的内容,可以进行一个搜索

    注意指南 git --help 和比如 git help clone 

    add        Add file contents to the index

       bisect     Find by binary search the change that introduced a bug

       branch     List, create, or delete branches

       checkout   Switch branches or restore working tree files

       clone      Clone a repository into a new directory

       commit     Record changes to the repository

       diff       Show changes between commits, commit and working tree, etc

       fetch      Download objects and refs from another repository

       grep       Print lines matching a pattern

       init       Create an empty Git repository or reinitialize an existing one

       log        Show commit logs

       merge      Join two or more development histories together

       mv         Move or rename a file, a directory, or a symlink

       pull       Fetch from and integrate with another repository or a local branch

       push       Update remote refs along with associated objects

       rebase     Forward-port local commits to the updated upstream head

       reset      Reset current HEAD to the specified state

       rm         Remove files from the working tree and from the index

       show       Show various types of objects

       status     Show the working tree status

       tag        Create, list, delete or verify a tag object signed with GPG

    git常规指令: 

    git status 查看文件状态

    git add 添加文件到“暂存区”

    git commit 文件名称 注意如果没有没有在commit 后面加上-m说明修改了什么,会自动进入vim界面,要求输入修改信息按键盘上的i代表开始输入内容,输入完毕后就按esc然后按:wp,所以如果我们以后在终端中提交最好在后面加上-m,注意 :git的add和svn不太一样,svn中只需要add一次,而git终每次新建或者修改后都需要重新add

    1.为添加之前的颜色,红色代表在工作区,2.添加到暂存区后的颜色,绿色代码在暂存区。

    了解工作区(working directory)版本库(repository)暂存区stage 分支(master)

    2git默认没有简写指令,一般情况下不建议提定义简写指令

  • 相关阅读:
    工作常用mysql命令以及函数
    mybati 字段映射
    关于idea切换账号,上传的代码依旧是之前账号提交/操作git
    java 开发过程中常用
    简单了解微服务
    zookeeper 学习(二) java操作zookeeper
    zookeeper 学习(一) 初识zookeeper
    漫画:我们为何结婚,又为何不忠?
    适用 selenium 自动化的十大测试场景
    女朋友买房了,我我我....
  • 原文地址:https://www.cnblogs.com/yangliangliang/p/4970132.html
Copyright © 2011-2022 走看看