Git的奇技淫巧
Git 常用命令集合,Fork 自 tips 项目 Git 是一个分布式版本管理工具,版本管理工具就是大家在写东西的时候都用过 回撤这个功能,但是回撤只能回撤几步,假如想要找回我三天之前的修改,光用回撤是找不回来的。而版本管理工具能记录每次的修改,只要提交到版本仓库,就可以找到之前任何时刻的状态(文本状态)。 下面的内容就是列举了常用的 Git 命令和一些小技巧,可以通过页面内查找的方式 Ctrl/Command+f 进行快速查找。 开卷必读 如果之前未使用过 Git,可以学习 Git 小白教程入门 一定要先测试命令的效果后,再用于工作环境中,以防造成不能弥补的后果!到时候别拿着砍刀来找我 所有的命令都在 git version 2.7.4 (Apple Git-66) 下测试通过 统一概念: 工作区:改动(增删文件和内容) 暂存区:输入命令:git add 改动的文件名,此次改动就放到了 ‘暂存区’ 本地仓库(简称:本地):输入命令:git commit 此次修改的描述,此次改动就放到了本地仓库,每个 commit,我叫它为一个版本。 远程仓库(简称:远程):输入命令:git push 远程仓库,此次改动就放到了远程仓库(GitHub 等) commit-id:输出命令:git log,最上面那行 commit xxxxxx,后面的字符串就是 commit-id 如果喜欢这个项目,欢迎 Star、提交 Pr、反馈问题😊 展示帮助信息 git help -g The command output as below: The common Git guides are: attributes Defining attributes per path cli Git command-line interface and conventions core-tutorial A Git core tutorial for developers cvs-migration Git for CVS users diffcore Tweaking diff output everyday A useful minimum set of commands for Everyday Git glossary A Git Glossary hooks Hooks used by Git ignore Specifies intentionally untracked files to ignore modules Defining submodule properties namespaces Git namespaces repository-layout Git Repository Layout revisions Specifying revisions and ranges for Git tutorial A tutorial introduction to Git tutorial-2 A tutorial introduction to Git: part two workflows An overview of recommended workflows with Git '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. 回到远程仓库的状态 抛弃本地所有的修改,回到远程仓库的状态。 ...