首页 技术 正文
技术 2022年11月6日
0 收藏 470 点赞 626 浏览 2256 个字

Git简单易用,只要输入git就可以列出他的所有参数

 C:\Users\spu>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.

git命令可以分为短和长选项。例如:

git commit  -m “hello git”

git commit –message=”hello git”

以上两条命令式等价的

1.Git入门

有两种简历git版本库的技术。可以从头开始创建,用现有的内容填充它,或者可以clone一个已有的版本库,从一个空的版本库比较简单,所有从空的版本库开始吧。

  1.1 创建一个初始版本库

  

 mkdir ~\public
cd ~\public
echo 'hello git' > index.html
git init

  git init将public目录转化为了git版本库。

  git不关心你是从一个空白的目录还是一个装满目录的文件开始的。在这两种情况下将目录转换为GIT版本库是完全一样的。

  为了显示目录是一个git版本库。git init创建了一个隐藏的.git目录。git将所有修订信息都放在这唯一的顶层.git目录中。

  1.2 将文件添加进版本库

  

 git add index.html
git commit -m 'init'
git status

  如果目录中有很多文件,可以用git add . 来添加进版本库。

  git将add、remove和commit分开,以避免频繁的变化。

  add仅仅只是把改变暂存在了本地。commit才是上传了改变。

  

  在add后,如果运行git status 可以查看git下一次将会把index.html上传给版本库

  除了原数据以外,git每次提交的时候,还会包括一些元数据,类似日志信息和作出本次变更的作者。

 

  如果仅仅只是运行git commit ,系统会调用设定好的编辑器来让你编辑

  

  

相关推荐
python开发_常用的python模块及安装方法
adodb:我们领导推荐的数据库连接组件bsddb3:BerkeleyDB的连接组件Cheetah-1.0:我比较喜欢这个版本的cheeta…
日期:2022-11-24 点赞:878 阅读:9,086
Educational Codeforces Round 11 C. Hard Process 二分
C. Hard Process题目连接:http://www.codeforces.com/contest/660/problem/CDes…
日期:2022-11-24 点赞:807 阅读:5,561
下载Ubuntn 17.04 内核源代码
zengkefu@server1:/usr/src$ uname -aLinux server1 4.10.0-19-generic #21…
日期:2022-11-24 点赞:569 阅读:6,410
可用Active Desktop Calendar V7.86 注册码序列号
可用Active Desktop Calendar V7.86 注册码序列号Name: www.greendown.cn Code: &nb…
日期:2022-11-24 点赞:733 阅读:6,183
Android调用系统相机、自定义相机、处理大图片
Android调用系统相机和自定义相机实例本博文主要是介绍了android上使用相机进行拍照并显示的两种方式,并且由于涉及到要把拍到的照片显…
日期:2022-11-24 点赞:512 阅读:7,820
Struts的使用
一、Struts2的获取  Struts的官方网站为:http://struts.apache.org/  下载完Struts2的jar包,…
日期:2022-11-24 点赞:671 阅读:4,903