git常用命令

git --version                                                            查看git版本
cd F:jiefu                                                              进入对应文件夹
git init                                                                 初始化仓库
git config --global user.name 'cppdy813'                                在全局配置用户名
git config --global user.email 'cppdy813@163.com'                  在全局配置邮箱
git add index.html                                                       将index.html添加到git队列中
git status                                                               查看状态
git rm --cached index.html                                               从git队列中删除index.html
git add *.html                                                           将某一类文件添加到git队列中
git add .                                                                将所有文件添加到git队列中
git commit -m '备注'                                                      提交到本地仓库并备注
touch .gitignore                                    创建.gitignore文件,并在文件中添加要忽略的文件和文件夹;忽略文件:log.txt;忽略文件夹:/dir1
git branch login                                                         创建分支并取名为login
git checkout login                                                       切换到login分支上
git checkout master                                                      切换到主线上
git merge login                                                          将主线和分支合并;注:必须在主线下操作此命令
git remote add origin https://github.com/jiefu813/springBoot.git         添加远程仓库地址
git push -u origin master                                                提交到远程仓库
git clone https://github.com/jiefu813/springBoot.git                     从远程仓库克隆到本地
原文地址:https://www.cnblogs.com/jiefu/p/10997967.html