一、Git 操作流程图

1.git --help 查看帮助

Administrator@PC-xiaobing MINGW64 /d/Git (master)
$ git --help
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.

2.git基础操作

Administrator@PC-xiaobing MINGW64 /d
$ cd D:/Git/ //cd到指定文件 Administrator@PC-xiaobing MINGW64 /d/Git
$ pwd //查看当前文件目录
/d/Git Administrator@PC-xiaobing MINGW64 /d/Git
$ git init //初始化本地git仓库
Initialized empty Git repository in D:/Git/.git/ Administrator@PC-xiaobing MINGW64 /d/Git (master)
$ git add test.txt //从工作区添加本地文件test.txt到暂存区 Administrator@PC-xiaobing MINGW64 /d/Git (master)
$ git commit -m "test" //从暂存区commit提交到本地仓库 //第一次安装Git提交commit的时候提示设置name和邮箱
*** Please tell me who you are.
Run
git config //global user.email "you@example.com"
git config //global user.name "Your Name" Administrator@PC-xiaobing MINGW64 /d/Git (master)
$ git config //global user.name "xiaobing" //根据提示设置name Administrator@PC-xiaobing MINGW64 /d/Git (master)
$ git config //global user.email "you@example.com" //根据提示设置邮箱 Administrator@PC-xiaobing MINGW64 /d/Git (master)
$ git commit -m "test" //从暂存区commit提交到本地仓库
[master (root-commit) 9bc4419] test
1 file changed, 1 insertion(+)
create mode 100644 test.txt
//接下来从本地仓库push到远程仓库

3.创建远程仓库GitHub或者GitLib

4.提交变更

git remote add origin https://github.com/xbtest/Demo01.git   //git remote 用于管理远程仓库
git push -u origin master //往名字为origin的仓库的master分支上提交变更的代码
Administrator@PC-xiaobing MINGW64 /d/eclipse-workspace/Demo01 (master)
$ git remote add origin https://github.com/xbtest/Demo01.git //添加失败
fatal: remote origin already exists.
$ git remote rm origin //执行rm删除后再次添加
$ git remote add origin https://github.com/xbtest/Demo01.git

第一次提交代码的时候提示登录

报错:

Administrator@PC-xiaobing MINGW64 /d/Git (master)
$ git push -u origin master
fatal: HttpRequestException encountered.
▒▒▒▒▒▒▒▒ʱ▒▒▒▒
Username for 'https://github.com': xbtest
Everything up-to-date
Branch master set up to track remote branch master from origin.

这时候需要 更新Windows的git凭证管理器

点击下载安装 GCMW-1.14.0.exe
下载链接
https://github.com/Microsoft/Git-Credential-Manager-for-Windows/releases/tag/v1.14.0

下载后双击安装即可,再次提交成功:

Administrator@PC-xiaobing MINGW64 /d/Git (master)
$ git push -u origin master
Everything up-to-date
Branch master set up to track remote branch master from origin.

5.验证查看

6.待续....

Git使用教程之初级入门命令行(二)的更多相关文章

  1. Android基础-系统架构分析,环境搭建,下载Android Studio,AndroidDevTools,Git使用教程,Github入门,界面设计介绍

    系统架构分析 Android体系结构 安卓结构有四大层,五个部分,Android分四层为: 应用层(Applications),应用框架层(Application Framework),系统运行层(L ...

  2. [Oracle] SQL*Loader 详细使用教程(2)- 命令行参数

    sqlldr工具   SQL*Loader的客户端工具是sqlldr,在操作系统的命令行下输入sqlldr,后面不接任何参数,将显示帮助信息如下所示(所有命令行参数的简单描述及其默认值),所以你并不需 ...

  3. git以及github的初级入门(一)

    本身学习git的操作是没什么兴趣的,毕竟原本是win平台学的java开发,git下那么多复制的命令行操作确实比较让人头疼,直到昨天我打开计算机的时候,我放置项目的E盘,以及F盘,G盘盘符都不见了!!我 ...

  4. python教程(一)·命令行基本操作

    先来了解下 "命令提示符". 等等?!既然本篇文章标题是"命令行基本操作",那怎么又说到"命令提示符"去了呢?客官莫要急,且听我说 命令提示 ...

  5. IntelliJ IDEA下Git的配置与使用(命令行下)

    1. 安装Git并配置好Git 安装与配置参见Git与码云(Git@OSC)入门-如何在实验室和宿舍同步你的代码(1)中的2.在本机安装Git与3.1 配置git. 2. 创建远程仓库 在gitee. ...

  6. git版本控制 for window安装和命令行使用

    Git 安装配置 Windows 平台上安装 在 Windows 平台上安装 Git 同样轻松,有个叫做 msysGit 的项目提供了安装包,可以到 GitHub 的页面上下载 exe 安装文件并运行 ...

  7. Git工程迁移方法总结(命令行)

    Git工程迁移方法总结 Git工程迁移方法总结 Git最近准备迁移一下位置,这里采用命令行的方式,做如下操作. 1.git init  初始化git仓库,这个时候发现本地文件夹多了个.git的文件夹. ...

  8. Git工程迁移方法总结(命令行) .(转载)

    原文地址:http://blog.csdn.net/hongshan50/article/details/236630433 Git工程迁移方法总结 Git工程迁移方法总结 Git最近准备迁移一下位置 ...

  9. git 工作流中的 Sourcetree 和命令行操作对比

    git 工作流操作 1.初始化本地仓库文件夹 终端进入项目文件夹 git init 隐藏文件夹中有 .git 文件夹则初始化成功 2.git 查看仓库状态 这里以新建一个 demo.txt 为例 ① ...

随机推荐

  1. Linux系列(27) - 三剑客grep、awk、sed

    Linux下一切皆文件,对Linux的操作就是对文件的处理 Linux中最重要的三个命令在业界被称为"三剑客",它们是awk,sed,grep 正则表达式就好比一个模版,这个模板就 ...

  2. Shell系列(33) - 多分支if语句简介及计算器例子

    多分支if条件语句 if [ 条件判断式1 ] then 当条件判断式1成立时,执行程序1 elif [ 条件判断式2 ] then 当条件判断式2成立时,执行程序2 ...省略更多条件... els ...

  3. Appium 自动化测试改造思路

    流水账脚本 从头到尾编写测试脚本 PO封装 业务行为与操作具体页面元素分离 basepage封装 如封装find方法,目的时增强稳定性 数据驱动封装 将常用的数据改为配置文件 为构建测试平台打基础

  4. kibana操作

    一些KIBANA的操作,记录下,免下次重复写 #创建索引名为kb_question的索引,并添加mapping,即各字段属性 PUT kb_question { "mappings" ...

  5. 『GoLang』数组与切片

    数组 数组是具有相同唯一类型的一组已编号且长度固定的数据项序列(这是一种同构的数据结构):这种类型可以是任意的原始类型例如整型.字符串或者自定义类型. 数组长度必须是一个常量表达式,并且必须是一个非负 ...

  6. [源码解析] PyTorch 流水线并行实现 (3)--切分数据和运行时系统

    [源码解析] PyTorch 流水线并行实现 (3)--切分数据和运行时系统 目录 [源码解析] PyTorch 流水线并行实现 (3)--切分数据和运行时系统 0x00 摘要 0x01 分割小批次 ...

  7. 几分钟就能学会的Python虚拟环境教程

    什么是虚拟环境 我们在使用Python的时候,通常用pip来进行包管理.比如我们要安装一个叫requests的库,那么我们就会采用以下命令去安装: pip install requests 那你知道, ...

  8. Pycharm软件学生和老师可申请免费专业版激活码

    有一种邮箱,叫做教育邮箱,这东西在这个互联网的世界有很大的优惠及特权,在 Jetbrain 这里, 如果你有教育邮箱(没有教育邮箱怎么办?.edu.cn后缀的邮箱)但很多学生.甚至老师都未必有. 你只 ...

  9. R7000 电脑调整亮度

    R7000 电脑亮度太亮,想调整亮度,fn+F5,F6 不起作用,需要调整显卡的设置

  10. 使用Mybatis的一些基本配置及Mybatis与数据库交互测试验证

    1.简介 什么是MyBatis? MyBatis 是一款优秀的持久层框架,它支持定制化 SQL.存储过程以及高级映射.MyBatis 避免了几乎所有的 JDBC 代码和手动设置参数以及获取结果集.My ...