安装配置
将其bin目录添加到path
ssh -keygen -t rsa -C 自己的邮箱(获取ssh远程连接秘钥)
使用:
进入项目目录 右击进入git bash 执行git init
github上new一个新仓库复制生成的例如:git@github.com:qinyios/mygitproject.git
然后执行git remote add origin git@github.com:qinyios/mygitproject.git 和远程仓库建立项目的联系 命令 git add 本地文件提交到暂存区
git commit 暂存区提交到本地仓库
git push将本地仓库的内容推送到远程仓库
git pull将远程仓库的内容拉取到本地仓库 第一次发布项目
ssh-keygen -t rsa
git add .
git commit -m “注释内容”
git remote add origin git@github.com:qinyios/mygitproject.git
git push -u origin master git clone 第二次提交:git push origin master 如果报错:To github.com:qinyios/mygitproject.git
! [rejected] master -> master (fetch first)
error: failed to push some refs to 'git@github.com:qinyios/mygitproject.git'
hint: Updates were rejected because the remote contains work that you do
hint: not have locally. This is usually caused by another repository pushing
hint: to the same ref. You may want to first integrate the remote changes
hint: (e.g., 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.
解决办法:
git pull --rebase origin master 再git push origin master git add 将文件添加进暂存区
git commit 将文件提交到本地分支
git checkout + 分支名字 切换分支
git checkout -b dev 创建并切换分支到dev
git branch 命令会列出所有分支,当前分支前面会标一个*号
git merge dev 把dev分支的工作成果合并到master分支上
git branch -d dev 删除dev分支//强制删除方法git branch -D dev;强制删除原因是远程分支删除了,本地还没删除所以要强制删除
git log --graph 命令可以看到分支合并图
git checkout --filename 把文件从工作区中修改的部分撤销
git reset HEAD readme.txt 可以把暂存区的修改撤销掉,重新放回工作区
git status 查看状态
git rm test.txt + git commit -m "remove test.txt" 删除文件并提交
git push origin +分支名字 把本地库的所有内容推送到远程库上 git stash 把当前工作现场“储藏”起来,等以后恢复现场后继续工作
git stash pop恢复的同时把stash内容也删了
git stash apply恢复,但是恢复后,stash内容并不删除,你需要用git stash drop来删除 git remote -v 查看远程库的信息
git clone 从远程库clone
git branch --set-upstream branch-name origin/branch-name建立本地分支和远程分支的关联

  

最新文章

  1. LOL(英雄联盟)提示不支持虚拟机登录,解决方法
  2. 磁盘阵列RAID原理、种类及性能优缺点对比
  3. DP大作战—组合背包
  4. 彻底禁止QQ更新
  5. guava学习--Optional可空类型
  6. hdu 4301(基本dp)
  7. 编译vo-aacenc遇到的问题
  8. Swift进阶
  9. iOS查错机制
  10. ubuntu修改环境变量
  11. Java中用正则表达式找出数字
  12. Redis【入门】就这一篇!
  13. FireDac 的一些应用提示
  14. 编程菜鸟的日记-初学尝试编程-C++ Primer Plus 第4章编程练习4
  15. Java控制台常用命令
  16. android 知识点汇总
  17. Mybatis 查询tinyint(1)的数据库字段时会自动转换成boolean类型
  18. Linux 下crontab 详解转
  19. 【JavaScript 从零开始】表达式和运算符(2)
  20. 【转载】注释AFX_MSG_MAP,AFX_DATA,AFX_DATA_MAP , Afx_MSG等宏不能删除

热门文章

  1. linux配置防火墙 Centos7下 添加 端口白名单
  2. gradle spring 配置解释
  3. jQuery-resize和scroll的性能优化
  4. Ubuntu安装 docker
  5. 搜索的应用--计算最优解:Aizu - ALDS1_4_D Allocation
  6. django-1-新手如何使用django
  7. golang的数据类型之字符串类型
  8. matplotlib系列——饼图
  9. [Java 教程 04] Java基础语法
  10. 数组Array的十种使用方法