學習git可到該網(wǎng)址學習:http://www.liaoxuefeng.com/wiki/0013739516305929606dd18361248578c67b8067c8c017b000( Git 教程 - 廖雪峰的官方網(wǎng)站 )
git reflog?? ??? ? (記錄的每一次命令)
git checkout -- 文件名?? (丟棄工作區(qū)的修改,用版本庫的內(nèi)容替換)
git status?? ??? ??? ? (查看當前倉庫狀態(tài))
git diff? 文件名?? ? (文件做比較)
git rm 文件名?? ??? ? (刪掉版本庫的文件)
git add -A ?? ??? ? (也可以將刪除的文件一起add到暫存區(qū),而無需一個個刪除)????
git reset --hard head^?? (會到上一個版本)
git reset --hard command的id (回到指定的版本)
git reset head 文件名?? ? (清空該文件在暫存區(qū)的內(nèi)容)
git remote add origin git@server-name:path/repo-name.git (本地倉庫關(guān)聯(lián)遠程庫,origin為自定義)
git push -u origin master?? ??? ??? ??? ? (把本地的master分支推送到遠程庫,第一次推送用-u)
git push origin master? ??? ??? ??? ??? ? (第二次以后可去掉參數(shù)-u)
git remote rm 遠程名稱(比如:origin)?? ??? ??? ? (刪除一個關(guān)聯(lián)的遠程庫名稱)
git remote -v?? ??? ??? ??? ??? ??? ? (列出關(guān)聯(lián)的遠程庫名稱)
git clone git@server-name:path/repo-name.git ?? ??? ? (將一個遠程庫的克隆到本地,默認克隆master的分支)
git checkout -b dev origin/dev?? ??? ??? ??? ? (本地創(chuàng)建一個分支,切換到該分支,將一個遠程庫的分支關(guān)聯(lián)到本地分支)
git log --graph?? ??? ??? ??? ??? ??? ? (查看分支合并圖)
git merge --no-ff -m "merge with no-ff" 分支名稱
git stash? ??? ??? ??? ??? ??? ??? ?? (未提交內(nèi)容,但保存了)
git stash apply stash@{n}?? ??? ??? ??? ?? (可選擇的恢復(fù)現(xiàn)場)
git stash list?? ??? ??? ??? ??? ??? ?? (查看保存的列表)
git stash apply?? ??? ??? ??? ??? ??? ?? (恢復(fù)最近保存的內(nèi)容,繼續(xù)編輯)
git stash drop?? ??? ??? ??? ??? ??? ?? (刪除保存的內(nèi)容)
git stash pop?? ??? ??? ??? ??? ??? ? (恢復(fù)保存的內(nèi)容,并刪除內(nèi)容)
git tag 版本名稱(為分支添加版本)
git tag 版本名稱 commitID
git show 版本名稱
git tag -d 版本名稱
git push origin 版本名稱?? ??? ??? ??? ? (推送某個標簽到遠程)
git push origin --tags ?? ??? ??? ??? ??? ? (一次性推送全部尚未推送到遠程的本地標簽)
git tag -d v0.9?? ??? ??? ??? ??? ??? ? (刪除本地標簽)
git push origin :refs/tags/v0.9?? ??? ??? ??? ? (刪除遠程標簽)
git branch -d 分支名稱?? ??? ??? ??? ??? ? (刪除分支)
git branch -D 分支名稱?? ??? ??? ??? ??? ? (強制刪除分支)
git pull?? (抓取最新的提交)
git branch --set-upstream dev origin/dev?? (指定本地分支與遠程分支的連接)
git reset HEAD readme.txt?? ??? ??? (清空readme.txt在暫存區(qū)里的內(nèi)容)
git branch (查看分支)
git branch name (創(chuàng)建分支)
git branch -d name (刪除分支)
git checkout name (切換分支,文件夾的內(nèi)容會做相應(yīng)的改變)
git checkout -b name (切換加創(chuàng)建)
git merge name (合并分支到當前分支)
git branch -m 原分支名 新分支名 (重命名分支)
git push --delete origin dev (刪除遠程庫分支)
更多文章、技術(shù)交流、商務(wù)合作、聯(lián)系博主
微信掃碼或搜索:z360901061

微信掃一掃加我為好友
QQ號聯(lián)系: 360901061
您的支持是博主寫作最大的動力,如果您喜歡我的文章,感覺我的文章對您有幫助,請用微信掃描下面二維碼支持博主2元、5元、10元、20元等您想捐的金額吧,狠狠點擊下面給點支持吧,站長非常感激您!手機微信長按不能支付解決辦法:請將微信支付二維碼保存到相冊,切換到微信,然后點擊微信右上角掃一掃功能,選擇支付二維碼完成支付。
【本文對您有幫助就好】元
