一、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 directoryinit       Create an empty Git repository or reinitialize an existing onework on the current change (see also: git help everyday)add        Add file contents to the indexmv         Move or rename a file, a directory, or a symlinkreset      Reset current HEAD to the specified staterm         Remove files from the working tree and from the indexexamine the history and state (see also: git help revisions)bisect     Use binary search to find the commit that introduced a buggrep       Print lines matching a patternlog        Show commit logsshow       Show various types of objectsstatus     Show the working tree statusgrow, mark and tweak your common historybranch     List, create, or delete branchescheckout   Switch branches or restore working tree filescommit     Record changes to the repositorydiff       Show changes between commits, commit and working tree, etcmerge      Join two or more development histories togetherrebase     Reapply commits on top of another base tiptag        Create, list, delete or verify a tag object signed with GPGcollaborate (see also: git help workflows)fetch      Download objects and refs from another repositorypull       Fetch from and integrate with another repository or a local branchpush       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.
Rungit 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] test1 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.待续....

转载于:https://www.cnblogs.com/xiaozhaoboke/p/11404038.html

Git使用教程之初级入门命令行(二)相关推荐

  1. git 修改commit_结合IDEA与命令行,解决常用git操作与特殊情况的最佳实践

    本文适合总觉得git操作不够顺滑,被各种分支问题搞得焦头烂额的Java业务开发同学. 如果是git的初学者,建议搜索下git其他入门教程,这方面资料很多,非常推荐git init一个新项目,然后本地操 ...

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

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

  3. 新一代 OIer 的快速入门命令行教程

    前言:为啥写这篇教程 几位家长:"欸wwh,你比赛时用啥写程序啊?" 我:"gedit + 命令行编译." (一番解释之后) 几位家长:"哦哦哦我明白 ...

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

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

  5. js 系统教程-15-js 语法之命令行-console.log,console.info,console.error,console.warn,debugger

    目录 目录 console 对象与控制台 console console 对象的静态方法 格式占位符 console.warn(),console.error() console.table() co ...

  6. mac退出linux命令行,mac/Linux日常入门命令行使用

    8种机械键盘轴体对比 本人程序员,要买一个写代码的键盘,请问红轴和茶轴怎么选? Linux/mac 命令行操作简单介绍 linux/mac 日常入门命令行使用--文件以及文件夹操作 日常文件夹以及文件 ...

  7. git 版本控制工具(五)-命令行汇总及其他操作

    一.命令行汇总 git config //配置本地仓库 常用git config --global user.name.git config --global user.email git confi ...

  8. python 基础命令-Python unittest第一篇:基础入门+命令行编译

    unittest单元测试框架最初受JUnit启发,与其他语言的主要单元测试框架具有相似的风格. 它支持测试自动化,支持开启或关闭某个测试,支持结合测试.另外它可以生成各个单元测试的报告.为了实现以上功 ...

  9. 音视频处理 ffmpeg初级开发 命令行工具-实用命令

    参考链接 ffmpeg Documentation 作者:smallest_one  链接:FFmpeg命令行工具-实用命令 - 简书 目录 1,help命令使用 1.1 ffmpeg命令的语法结构 ...

  10. 远程连接别人电脑教程,超详细(命令行方式)

    1.这里我们点击系统搜索按钮,输入命令:mstsc 会弹出一个远程远程桌面连接:单击(命令行) 2.点击显示选项 3.输入对方电脑的IP地址跟用户名,点击连接 4.会提示你输入密码,密码正确就成功连接 ...

最新文章

  1. 面试官问:你来讲下Netty通信中的粘包、拆包?
  2. Mysql高级之触发器
  3. 自学python转行-转行Python,应该如何短期自学,达到就业水平
  4. Pytorch学习-Task1
  5. python 写txt 换行_python中写入txt文件需要换行,以及\r 和\n
  6. 百度贴吧的数据抓取和分析(一):指定条目帖子信息抓取
  7. sparksql一些指标
  8. 怎样查询2021高考模拟成绩,2021年高三一模二模三模哪个成绩更接近高考成绩,看看网友是怎么评论...
  9. Linux 基金会发布《软件物料清单和网络安全准备度现状》报告
  10. HDU - 2609 - How many
  11. linux 445端口关闭,windows关闭445端口
  12. caxa cam数控车2020破解版 v20.0.0.6460附安装教程|caxa数控车2020破解版
  13. 最近一直在好奇一个问题,QWE到底等不等于ABC? -.- .. --.- .-.. .-- - ..-. -.-. --.- --. -. ... --- --- flag格式:CTF{xxx}
  14. jQuery事件自动触发
  15. flash for linux安装教程,Flash Player 9 FOR Linux 的安装
  16. 搭建centos 7 并部署ftp的详细过程
  17. Excel2013 基本用法(上)
  18. 怎么理解产品经理职位?
  19. 微信推文中图片无法保存的解决方案
  20. 1.1.1. Ordinary Least Squares(普通最小二乘)

热门文章

  1. 怎样从任务管理器打开计算机,怎么打开任务管理器|任务管理器在哪里打开
  2. HTML-CSS前端大作业一站式教育机构响应式前端网页网站模板
  3. win10, cuda 9.0, python 3.5环境下复现 Flow-Guided Feature Aggregation for Video Object Detection 问题总结
  4. 【大话设计模式】——设计模式概论
  5. Processing交互应用——躲避炸弹
  6. 2013.12.26 M-Learning
  7. InnoDB的MVCC如何解决不可重复读和快照读的幻读,当前读用next-key解决幻读
  8. 罗永浩:关于苹果的产品、传闻和一些优点
  9. 西游记中牛魔王的雄厚实力和家业地盘
  10. Base64和Base64URL加解密