Git基礎

Git 基礎

  • local 基本操作
  • remote基本操作

初始化

  • 用戶名&郵箱設置
    git config --global user.name{name}
    git config --global user.email{email}
  • 免密碼設置
    • 在用戶目錄下創建.git-credentials文件,並輸入以下內容
        http://{username}:{password}@10.35.52.34
 -  運行以下命令
        git config --global credential.helper store
 -  http最大緩存設置
        git config --global http.postBuffer 524288000
 -  大小寫敏感設置
        git config --global core.ignorecase false

Git 工作流

  • feature->examination->release
  • hotfix

Tips

  • 本地文件狀態
    git status -s
  • 本地分支與遠端track關係
    git branch -vv
  • 創建本地分支並關聯
    git branch {branchname}
    git push -u origin HEAD
  • 刪除遠端已合併的本地分支
    git fetch -p
    git branch -vv | grep ':gone]' |sed 's/^\s\s//' | sed 's/\s.*$//g' | grep -v master | xargs -n 1 git branch -d
  • 配置diff及merge工具
    • diff

      git config --global diff.tool {toolname}
      git config --global difftool.{toolname}.path "{path}"
    • merge

      git config --global merge.tool {toolname}
      git config --global mergetool.{toolname}.path "{path}"
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章