1.配置全局信息
$ git config --global user.name "****"
$ git config --global user.email " ******.com"2.开始使用git
1. 建仓 =>
$ git init 2. 加仓 =>
$ git add . ( 后面的那个点是必须的 ) 3. 提交 =>
$ git commit -m "注释信息" 4. 本地关联远程仓库加别名 =>
$ git remote add origin https:// github . ****.git 4.1 可以删除别名 =>
$ git remote remove 别名 5. 从远程仓拉项目 =>
$ git pull origin master 6. 上传到远程仓库 =>
$ git push origin master * 报错的话 可以 => $ git pull --rebase origin master 7 .查询历史日志 =>
$ git reflog 8 .版本切换 =>
$ git reset --hard 版本号3.分支结构=> 修bug 和 改新需求冲突时
1. 查看分支 =>
$ git branch 2 .创建分支 =>
$ git branch 分支名 3 .切换分支 =>
$ git chekout 分支名 (完成修改后,执行 git add . , git commit -m "") 4 .合并分支 =>
$ git merge 分支名 (合并之前要切回到master,用master merge 分支)4.配置公钥免登录
1. 删除远程别名 =>
$ git remote remove 别名 2 .更换远程ssh 地址 =>
$ git remote add origin @***.ssh 3 .ssh 创建key =>
$ ssh-keygen -t rsa -C “config 的邮箱” (一路回车) 4 .在git 中生成公钥的本地路径
在c盘(id-rsa.pub: 公钥) 在客户端配置公钥