git 常用操作
阿新 • • 發佈:2018-06-19
命令 pat 構建 eset 版本回退 初始化 git diff stat tag
<li>git init "在本地初始化git倉庫"</li>
<li>git add file "添加文件到暫存區"</li>
<li>git commit -m ‘xxx‘ "將文件提交到git倉庫"</li>
<li>git status "查看文件狀態"</li>
<li>git diff "查看修改內容"</li>
<li>git log "查看提交歷史"</li>
<li>git reflog "查看命令歷史"</li>
<li>git reset --hard commit_id "本地版本回退" git push origin master --force</li>
<li>git revert "遠端版本號" "遠端回退上一版"</li>
<li>git checkout --file "丟棄工作區修改"</li>
<li>git rm file "用來刪除一個文件"</li>
<li>git remote add origin git@server-name:path/repo-name.git "關聯一個遠端倉庫"</li>
<li>git push -u origin master "第一次推送遠端內容"</li>
<li>git clone 遠端地址 "克隆遠端倉庫到本地"</li>
<li>git branch "查看分支 *代表當前分支"</li>
<li>git branch ‘name‘ "創建新分支"</li>
<li>git checkout ‘name‘ "創建分支並且切換到分支"</li>
<li>git merge ‘分支名‘ "將分支merge到當前分支"</li>
<li>git branch -d ‘name‘ "刪除分支"</li>
<li>git log --graph "查看分支合並圖"</li>
<li>git remote -v "查看遠程庫信息"</li>
<li>git tag "查看所有標簽"</li>
<li>git tag ‘name‘ "新建標簽"</li>
<li>git tag ‘name‘ commit id "為指定標簽打tag"</li>
<li>git tag -a ‘name‘ -m ‘xxx‘ "指定標簽信息"</li>
<li>git push origin ‘tagname‘ "向遠程推送本地標簽"</li>
<li>git push origin --tags "推送全部未推送的標簽"</li>
<li>git tag -d ‘tagname‘ "刪除標簽"</li>
<li>git push origin :refs/tags/‘tagname‘ "刪除一個遠程標簽"</li>
<li>git push --set-upstream origin dev "本地新建分支在遠端構建"</li>
git 常用操作