Git Brash 的使用总结(持续更新)

  1. git Brash
  • git 是 分布式控制系统,能够在本地上管理代码,或者上传代码。
  • git brash 是 windows 下的 git 命令工具。
  1. 使用

    • 打开git Brash
    • 查看是是否安装了git
      • git -version
    • 设置 本地仓库
      • 右键选中要做为本地仓库的文件夹
      • 选择Git Brash Here
      • 输入 git init ,当前文件夹会出现一个.git文件夹
      • ls -al 查看当前的文件夹
    • 从github上克隆文件到本地
      • git clone **
      • ** 代表是你所在的github上的.git后缀名的地址。在github上可以查看到。
    • 上传文件
      • git add . 将改动添加到暂存区
      • git commit -m "first commit"
    • 修改文件
    • 提交到github上
      • git remote add origin github上已存在的项目地址 //origin是别名
    • 将本地更改推送到远程的master
      • git push origin master
      • 如果github的remote上已经有了文件,会出现错误。先进行pull操作,再push
        • git pull origin master
        • git push origin master
    • 查看git-config
      • git config --list
    • 设置全局变量
      • git config --global user.name "123"
      • git config --global user.email "123@163.com"
    • 分支
      • 新建分支并跳转到分支
        • git checkout -b gh-pages
      • 查看本地所有分支
        • git branch
      • 查看本地和远程上的所有分支
        • git branch -a
      • 删除本地分支
        • git branch -d gh-pgaes
      • 删除远程分支
        • git push origin --delete gh-pages
      • 强制新增文件夹dist
        • git add -f dist
      • 将仓库中某一个文件夹作为展示项(gh-pages)
        • git subtree push --prefix=dist origin gh-pages
      • 将某仓库中所有都展示
        + text git:(master) git symbolic-ref HEAD refs/heads/gh-pages
        + git add -A
        + git commit -m "..."
        + git push origin gh-pages

    参考:
    https://www.jianshu.com/p/6da1027239c6

原文地址:https://www.cnblogs.com/fanruili/p/13331246.html