前言:命令是在Git Bash 下输入的命令,GUI部分涉及到小乌龟git,可以自行安装,不同版本有差异,用git的新手也可以尝试 SourceTree 提供漂亮的图形化界面操作(但是卡顿坑多,需三思)
1、目标
- 介绍git安装
- Git的小乌龟GUI操作
- Git bash的命令
- 主要提供方向不提供具体命令操作是啥,其实还得动手
2、安装
不同版本的小乌龟有差异,注意此文的小乌龟版本是 TortoiseGit 2.13.0.1
、Git版本是 2.33.0.windows.2
,查看git版本指令 git version
$ git version
git version 2.33.0.windows.2
查看小乌龟版本:
1、可以直接打开小乌龟查看
2、右键文件夹内空白处选择 TortoiseGit > About
官网
1、可选择下载windows、maxOS、Linux/Unix 的 Git Downloads
2、官网的说明文档有提供参考书书籍、指令等 Git Documentation
3、官网社区服务,可反馈问题、bug等 Git Community
放到注册表
下载git/小乌龟后,可放到windows注册后可以在某个文件夹的空白处邮件显示小乌龟按钮,方便操作,一般也会自动添加,若没有自动添加可自定义
1、windows10及以上直接 win键 > 输入注册表编辑器搜索后打开
2、windows10以下按组合快捷键“win10 + R” 打开运行 > 输入命令:Regedit,点击“确定” 或回车打开Windows的注册表
注册表修改需要万分注意!!!! 可按以下路径配置git
3、命令
前期可百度或者官网或者根据提示学习git指令,熟悉后可自由发挥
1、参考官网提供文档 Git Commands
2、打开git bash,输入 git --help
可获得大部分常用指令,以及其他帮助指令
$ git --help
usage: git [--version] [--help] [-C <path>] [-c <name>=<value>]
[--exec-path[=<path>]] [--html-path] [--man-path] [--info-path]
[-p | --paginate | -P | --no-pager] [--no-replace-objects] [--bare]
[--git-dir=<path>] [--work-tree=<path>] [--namespace=<name>]
[--super-prefix=<path>] [--config-env=<name>=<envvar>]
<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
restore Restore working tree files
rm Remove files from the working tree and from the index
sparse-checkout Initialize and modify the sparse-checkout
examine the history and state (see also: git help revisions)
bisect Use binary search to find the commit that introduced a bug
diff Show changes between commits, commit and working tree, etc
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
commit Record changes to the repository
merge Join two or more development histories together
rebase Reapply commits on top of another base tip
reset Reset current HEAD to the specified state
switch Switch branches
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.
See 'git help git' for an overview of the system.
4、小乌龟 GUI
例如鼠标右击文件夹内空白处 > TortoiseGit :
进入 help
可获得帮助大全!!!!!
常用是查看历史记录 Show log
、撤回修改Revert
、合并分支 Merge...
、新建分支 Create Branch ...
、切换分支Switch/Checkout
… 等等等等等等
新手难理解官方文档的建议先找资料了解,最后以官方文档为主,毕竟还得是官方