zoukankan      html  css  js  c++  java
  • 安装Git版本控制系统 以及Git Bash的基础命令

    Git是一个开源的分布式版本控制系统,用于敏捷高效地处理任何或小或大的项目。Git 是 Linus Torvalds 为了帮助管理 Linux 内核开发而开发的一个开放源码的版本控制软件。

    1.官网下载。网址为:https://git-scm.com/download。截图如下所示。点击“Downloads for Windows”按钮,便可跳转到下载链接,完成下载。

    2.点击之后进入下载页面,下载最新版本后有了这个文件夹然后双击

    3.接下来进行安装,选安装地址

    可勾选:On the Desktop,这样,会自动在桌面生成Git的快捷方式。

    可不勾选:Git GUI Here。目前,我都是使用Git Bash来进行操作。使用Git GUI,确实可以得到更好的UI体验,不过,个人认为会减低效率。并且,初学者,还是先搞懂Git的常用指令,之后,再使用Git GUI才会有更好的理解。

    4.安装Git完成之后,会在桌面创建Git Bash快捷方式,在任意目录下右击鼠标可以找打Git Bash Here的选项。打开Git客户端界面,输入git。

    或者在Windows里面输入Git点击Git-bash进入命令界面弹框

    5.命令弹框

    lenovo@LAPTOP-LG72BB3R MINGW64 /
    $ git
    usage: git [--version] [--help] [-C <path>] [-c name=value]
               [--exec-path[=<path>]] [--html-path] [--man-path] [--info-path]
               [-p | --paginate | --no-pager] [--no-replace-objects] [--bare]
               [--git-dir=<path>] [--work-tree=<path>] [--namespace=<name>]
               <command> [<args>]
    
    These are common Git commands used in various situations:
    
    start a working area (see also: git help tutorial)
       clone      Clone a repository into a new directory
       init       Create an empty Git repository or reinitialize an existing one
    
    work on the current change (see also: git help everyday)
       add        Add file contents to the index
       mv         Move or rename a file, a directory, or a symlink
       reset      Reset current HEAD to the specified state
       rm         Remove files from the working tree and from the index
    
    examine the history and state (see also: git help revisions)
       bisect     Use binary search to find the commit that introduced a bug
       grep       Print lines matching a pattern
       log        Show commit logs
       show       Show various types of objects
       status     Show the working tree status
    
    grow, mark and tweak your common history
       branch     List, create, or delete branches
       checkout   Switch branches or restore working tree files
       commit     Record changes to the repository
       diff       Show changes between commits, commit and working tree, etc
       merge      Join two or more development histories together
       rebase     Reapply commits on top of another base tip
       tag        Create, list, delete or verify a tag object signed with GPG
    
    collaborate (see also: git help workflows)
       fetch      Download objects and refs from another repository
       pull       Fetch from and integrate with another repository or a local branch
       push       Update remote refs along with associated objects
    
    'git help -a' and 'git help -g' list available subcommands and some
    concept guides. See 'git help <command>' or 'git help <concept>'
    to read about a specific subcommand or concept.
    
    lenovo@LAPTOP-LG72BB3R MINGW64 /
    $ pwd
    /
    
    lenovo@LAPTOP-LG72BB3R MINGW64 /
    $ ls
    bin/  cmd/  dev/  etc/  git-bash.exe*  git-cmd.exe*  LICENSE.txt  mingw64/  proc/  ReleaseNotes.html  tmp/  unins000.dat  unins000.exe*  unins000.msg  usr/
    
    lenovo@LAPTOP-LG72BB3R MINGW64 /
    $



    6.然后就可以开始用Git了,,,基础知识
    Git bash 下操作文件及文件夹命令

    1, cd : change directory的简写,改变目录的意思,就是切换到哪个目录下, 如 cd e:fff  切换 E 盘下面的fff 目录。

      当我们用cd 进入文件夹时,我们可以使用 通配符*, cd f*,  如果E盘下只有一个f开头的文件夹,它就会进入到这个文件夹.

    2, cd .. 回退到上一个目录。我们在写js,或css时,我们引入文件时,.. 表示的就是上一个目录, 所以 cd .. 回退到上一个目录就很好理解了。注意,cd 和两个点点..之间有一个空格,  

    3, pwd : print working directory, 打印工作目录,它会显示我们当前所在的目录路径。

    4, ls: list, 列出当前目录中的所有文件,     只不过ll(两个ll)列出的内容更为详细。

    5, touch : 新建一个文件 如 touch index.js 就会在当前目录下新建一个index.js文件。

    6,rm:  remove,删除一个文件, rm index.js 就会把index.js文件删除.

    7,  mkdir: make directory 新建一个目录,就是新建一个文件夹. 如mkdir src 新建src 文件夹.

    8,  rm -r :  删除一个文件夹, r (recusive 是递归的意思), 删除用的就是递归,先删除文件夹里面的内容,再删除文件夹。 rm -r src 删除src目录。 

    9,  mv 移动文件, mv index.html src   index.html 是我们要移动的文件, src 是目标文件夹,当然, 这样写,必须保证文件和目标文件夹在同一目录下.

    10, reset 清屏,把git bash命令窗口中的所有内容清空。

  • 相关阅读:
    sparksql
    axis2客户端
    windows命令
    如何进行大数据分析及处理(总结)
    linux下如何关闭防火墙?如何查看防火墙当前的状态
    mysql 快速简单安装法
    数据分析笔记
    建设数据仓库的八个步骤
    Java工作记录
    IIS虚拟目录和应用程序
  • 原文地址:https://www.cnblogs.com/dennyxiao/p/8558862.html
Copyright © 2011-2022 走看看