设置用户名
git config --global user.name 用户名
git config --global user.name Qiao
设置用户签名
git config --global user.email 邮箱
git config --global user.email 12345678@qq.com
初始化本地库
git init
ll -a 是查看隐藏文件
查看本地库状态
git status
On branch master 当前分支
No commits yet 没提交过东西
nothing to commit (create/copy files and use “git add” to track) 没什么东西需要提交
添加到暂存区
git add 文件名
提交到本地库
git commit -m “日志信息” 文件名
查看历史记录
git reflog # 精简版的命令
git log
版本穿梭
git reset --hard 版本号
git reset --hard 12345
分支的操作
创建分支
git branch 分支名
查看分支
git branch -v
切换分支
git checkout 分支名
指定的分支合并到当前分支上
git merge 分支名
查看当前所有远程地址别名
git remote -v
起别名
git remote add 别名 远程地址
推送本地分支上的内容到远程仓库
git push 别名 分支
将远程仓库的内容克隆到本地
git clone 远程地址
将远程仓库对于分支最新内容拉下来与当前本地分支直接合并
git pull 远程库地址别名 远程分支名