git安装步骤:https://www.cnblogs.com/wj-1314/p/7993819.html

git:教程:https://www.liaoxuefeng.com/wiki/0013739516305929606dd18361248578c67b8067c8c017b000

git工作流:https://github.com/xirong/my-git/blob/master/git-workflow-tutorial.md

git常用命令:

基本信息设置

  • 设置用户名 和 邮箱
  • git config --global user.name “用户名,例如我就会写Leonidas”
    //为“某一个仓库”配置只需要去掉global即可
  • git config --global user.email “邮箱,例如我就会写956xxxxx@qq.com”
  • 创建或克隆一个本地目录作为 本地代码仓库
  • cd d:/dev/android/gitstory
    //进入到相应的文件目录下,除了使用命令行之外,(Windows环境下)还可以直接通过“文件资源管理器”自己进入到想作为本地仓库的位置,点击鼠标右键打开Git Bash,然后在进行初始化操作也行。
  • git init //在此目录下初始化此目录为git仓库
  • git clone https://github.com/Leonidas-Li/GameOfLife.git //克隆一个仓库到本地
  • git remote add origin https://github.com/Leonidas-Li/GameOfLife.git
    //添加关联的远程仓库到本地
  • git push -u origin master
    //master是以
  • git remote
    //远程仓库的名称一般默认为origin(也可以设置为其它名称)
  • git remote -v
    //查看关联的远程仓库的详细信息
  • git remote remove origin(远程仓库的名字)
    //删除远程仓库关联
  • rm -rf .git //删除git仓库
  • ssh
  • git init --bare
收藏 打印