下载地址:https://git-scm.com/downloads
Additional icons:附加图标
On the Desktop:在桌面上
Windows Explorer integration:Windows资源管理器集成鼠标右键菜单
Git Bash Here:命令行工具
Git GUI Here:可视化工具
Git LFS (Large File Support):大文件支持
Associate .git* configuration files with the default text editor:将.git配置文件与默认文本编辑相关联
Associate .sh files to be run with Bash:将.sh文件关联到bash运行
Use a TrueType font in all console windows:在所有控制台窗口中使用TrueType字体
Check daily for Git for Windows updates:每天检查Git是否有Windows更新
Use the Nano editor by default:默认使用 Nano 编辑器
Use Vim (The ubiquitous text editor) as Git’s default editor:使用 Vim 作为 Git 的默认编辑器
Use Notepad++ as Git’s default editor:使用 Notepad++ 作为 Git 的默认编辑器
Use Visual Studio Code as Git’s default editor:使用 Visual Studio Code 作为 Git 的默认编辑器
# 设置开发者的用户名 git config -global user.name ‘用户名’ # 设置开发者的邮箱 git config -global user.email ‘邮箱’ # 取得全局信息 git config --list生成公钥私钥
# 生成公钥私钥 执行后回车三次enter ssh-keygen -t rsa -C "email" # 查看生成的公钥 cat ~/.ssh/id_rsa.pub基础操作
# 初始化git仓库 git init # 把当前目录设置为git仓库 git init --bare # 查看仓库状态 git status # 将文件添加到git暂存区中 git add 文件名字 # 把所有文件添加到git暂存区中 git add . # 提交代码 git commit -m "提交的注解信息" # 自动添加并提交修改到当前版本 git commit -a -m "提交的注解信息" # 比较修改前和修改后的文件区别 git diff 文件 # 查看提交历史 git log 文件 # 查看所有的日志 git log # 一行显示所有日志 git log --pretty=oneline # 回退到上一个版本 git reset --hard head~1 # 查看所有删除提交点 git reflog # 版本穿梭 git reset --hard 版本 # 查看修改了的文件 git checkout 文件 # 把保存在暂存区的文件返回到工作区 git reset head 文件名 # 查看仓库的所有分支 git branch # 创建分支 git branch 分支名 # 切换分支 git checkout 分支名 # 在master分支下合并分支 git merge 分支名 # 删除分支 git branch -d 分支名 # 创建分支并跳转到改分支 git checkout -b 分支名 # 不适用fast forward合并 git merge --no -ff -m “注解” 分支名 # 查看分支日志 git log --graph --pretty=oneline暂存区
# 暂存分支 git stash # 暂存区列表 git stash list # 恢复暂存区 git stash apply # 清除暂时挂起的暂存区 git stash drop # 一步恢复展挂和删除暂挂区 git stash pop补丁
# 把两个分支的区别打成补丁 git diff 分支>包名 # 例: git diff master>patch # 使用补丁 git apply patch # 格式化补丁 git format-patch -M master # 格式化补丁使用 git am 格式化的补丁远程git关联
# 创立客户端与服务器端的连接地址信息 git remote add origin 仓库地址 # 把本地的git仓库推送到服务器上 git push -u origin master # 克隆仓库信息 git clone 地址 # 删除远程仓库 git remote rm origin # 删除远程分支 git push origin --delelte 分支名 # 查看远程仓库可以使用的命令 git remote # 查看远程仓库可以使用的详细命令 git remote -v # 将远程仓库的分支抓取到新的分支 git checkout -b 新分支名字 origin/远程仓库分支标签
# 设置标签 git tag 标签名字 # 查看所有的标签 git tag # 删除标签 git tag -d 标签名



