久久久久久久视色,久久电影免费精品,中文亚洲欧美乱码在线观看,在线免费播放AV片

<center id="vfaef"><input id="vfaef"><table id="vfaef"></table></input></center>

    <p id="vfaef"><kbd id="vfaef"></kbd></p>

    
    
    <pre id="vfaef"><u id="vfaef"></u></pre>

      <thead id="vfaef"><input id="vfaef"></input></thead>

    1. 站長(zhǎng)資訊網(wǎng)
      最全最豐富的資訊網(wǎng)站

      介紹Git 常用命令大全

      介紹Git 常用命令大全

      一、 Git 常用命令速查

      git branch 查看本地所有分支
      git status 查看當(dāng)前狀態(tài)
      git commit 提交
      git branch -a 查看所有的分支
      git branch -r 查看遠(yuǎn)程所有分支
      git commit -am "init" 提交并且加注釋
      git remote add origin git@192.168.1.119:ndshow
      git push origin master 將文件給推到服務(wù)器上
      git remote show origin 顯示遠(yuǎn)程庫(kù)origin里的資源
      git push origin master:develop
      git push origin master:hb-dev 將本地庫(kù)與服務(wù)器上的庫(kù)進(jìn)行關(guān)聯(lián)
      git checkout –track origin/dev 切換到遠(yuǎn)程dev分支
      git branch -D master develop 刪除本地庫(kù)develop
      git checkout -b dev 建立一個(gè)新的本地分支dev
      git merge origin/dev 將分支dev與當(dāng)前分支進(jìn)行合并
      git checkout dev 切換到本地dev分支
      git remote show 查看遠(yuǎn)程庫(kù)
      git add .
      git rm 文件名(包括路徑) 從git中刪除指定文件
      git clone git://github.com/schacon/grit.git 從服務(wù)器上將代碼給拉下來(lái)
      git config –list 看所有用戶(hù)
      git ls-files 看已經(jīng)被提交的
      git rm [file name] 刪除一個(gè)文件
      git commit -a 提交當(dāng)前repos的所有的改變
      git add [file name] 添加一個(gè)文件到git index
      git commit -v 當(dāng)你用-v參數(shù)的時(shí)候可以看commit的差異
      git commit -m "This is the message describing the commit" 添加commit信息
      git commit -a -a是代表add,把所有的change加到git index里然后再commit
      git commit -a -v 一般提交命令
      git log 看你commit的日志
      git diff 查看尚未暫存的更新
      git rm a.a 移除文件(從暫存區(qū)和工作區(qū)中刪除)
      git rm –cached a.a 移除文件(只從暫存區(qū)中刪除)
      git commit -m "remove" 移除文件(從Git中刪除)
      git rm -f a.a 強(qiáng)行移除修改后文件(從暫存區(qū)和工作區(qū)中刪除)
      git diff –cached 或 $ git diff –staged 查看尚未提交的更新
      git stash push 將文件給push到一個(gè)臨時(shí)空間中
      git stash pop 將文件從臨時(shí)空間pop下來(lái)
      ———————————————————
      git remote add origin git@github.com:username/Hello-World.git
      git push origin master 將本地項(xiàng)目給提交到服務(wù)器中
      ———————————————————–
      git pull 本地與服務(wù)器端同步
      —————————————————————–
      git push (遠(yuǎn)程倉(cāng)庫(kù)名) (分支名) 將本地分支推送到服務(wù)器上去。
      git push origin serverfix:awesomebranch
      ——————————————————————
      git fetch 相當(dāng)于是從遠(yuǎn)程獲取最新版本到本地,不會(huì)自動(dòng)merge
      git commit -a -m "log_message" (-a是提交所有改動(dòng),-m是加入log信息) 本地修改同步至服務(wù)器端 :
      git branch branch_0.1 master 從主分支master創(chuàng)建branch_0.1分支
      git branch -m branch_0.1 branch_1.0 將branch_0.1重命名為branch_1.0
      git checkout branch_1.0/master 切換到branch_1.0/master分支
      du -hs

      git branch 刪除遠(yuǎn)程branch
      git push origin :branch_remote_name
      git branch -r -d branch_remote_name
      ———————————————————–

      初始化版本庫(kù),并提交到遠(yuǎn)程服務(wù)器端
      mkdir WebApp
      cd WebApp
      git init 本地初始化
      touch README
      git add README 添加文件
      git commit -m 'first commit'
      git remote add origin git@github.com:daixu/WebApp.git

      增加一個(gè)遠(yuǎn)程服務(wù)器端

      上面的命令會(huì)增加URL地址為'git@github.com:daixu/WebApp.git',名稱(chēng)為origin的遠(yuǎn)程服務(wù)器庫(kù),以后提交代碼的時(shí)候只需要使用 origin別名即可

      推薦(免費(fèi)):Git

      二、 Git 命令速查表

      1、常用的Git命令

      命令

      簡(jiǎn)要說(shuō)明

      git add

      添加至?xí)捍鎱^(qū)

      git add–interactive

      交互式添加

      git apply

      應(yīng)用補(bǔ)丁

      git am

      應(yīng)用郵件格式補(bǔ)丁

      git annotate

      同義詞,等同于 git blame

      git archive

      文件歸檔打包

      git bisect

      二分查找

      git blame

      文件逐行追溯

      git branch

      分支管理

      git cat-file

      版本庫(kù)對(duì)象研究工具

      git checkout

      檢出到工作區(qū)、切換或創(chuàng)建分支

      git cherry-pick

      提交揀選

      git citool

      圖形化提交,相當(dāng)于 git gui 命令

      git clean

      清除工作區(qū)未跟蹤文件

      git clone

      克隆版本庫(kù)

      git commit

      提交

      git config

      查詢(xún)和修改配置

      git describe

      通過(guò)里程碑直觀地顯示提交ID

      git diff

      差異比較

      git difftool

      調(diào)用圖形化差異比較工具

      git fetch

      獲取遠(yuǎn)程版本庫(kù)的提交

      git format-patch

      創(chuàng)建郵件格式的補(bǔ)丁文件。參見(jiàn) git am 命令

      git grep

      文件內(nèi)容搜索定位工具

      git gui

      基于Tcl/Tk的圖形化工具,側(cè)重提交等操作

      git help

      幫助

      git init

      版本庫(kù)初始化

      git init-db*

      同義詞,等同于 git init

      git log

      顯示提交日志

      git merge

      分支合并

      git mergetool

      圖形化沖突解決

      git mv

      重命名

      git pull

      拉回遠(yuǎn)程版本庫(kù)的提交

      git push

      推送至遠(yuǎn)程版本庫(kù)

      git rebase

      分支變基

      git rebase–interactive

      交互式分支變基

      git reflog

      分支等引用變更記錄管理

      git remote

      遠(yuǎn)程版本庫(kù)管理

      git repo-config*

      同義詞,等同于 git config

      git reset

      重置改變分支“游標(biāo)”指向

      git rev-parse

      將各種引用表示法轉(zhuǎn)換為哈希值等

      git revert

      反轉(zhuǎn)提交

      git rm

      刪除文件

      git show

      顯示各種類(lèi)型的對(duì)象

      git stage*

      同義詞,等同于 git add

      git stash

      保存和恢復(fù)進(jìn)度

      git status

      顯示工作區(qū)文件狀態(tài)

      git tag

      里程碑管理

      2、對(duì)象庫(kù)操作相關(guān)命令

      命令

      簡(jiǎn)要說(shuō)明

      git commit-tree

      從樹(shù)對(duì)象創(chuàng)建提交

      git hash-object

      從標(biāo)準(zhǔn)輸入或文件計(jì)算哈希值或創(chuàng)建對(duì)象

      git ls-files

      顯示工作區(qū)和暫存區(qū)文件

      git ls-tree

      顯示樹(shù)對(duì)象包含的文件

      git mktag

      讀取標(biāo)準(zhǔn)輸入創(chuàng)建一個(gè)里程碑對(duì)象

      git mktree

      讀取標(biāo)準(zhǔn)輸入創(chuàng)建一個(gè)樹(shù)對(duì)象

      git read-tree

      讀取樹(shù)對(duì)象到暫存區(qū)

      git update-index

      工作區(qū)內(nèi)容注冊(cè)到暫存區(qū)及暫存區(qū)管理

      git unpack-file

      創(chuàng)建臨時(shí)文件包含指定 blob 的內(nèi)容

      git write-tree

      從暫存區(qū)創(chuàng)建一個(gè)樹(shù)對(duì)象

      3、引用操作相關(guān)命令

      命令

      簡(jiǎn)要說(shuō)明

      git check-ref-format

      檢查引用名稱(chēng)是否符合規(guī)范

      git for-each-ref

      引用迭代器,用于shell編程

      git ls-remote

      顯示遠(yuǎn)程版本庫(kù)的引用

      git name-rev

      將提交ID顯示為友好名稱(chēng)

      git peek-remote*

      過(guò)時(shí)命令,請(qǐng)使用 git ls-remote

      git rev-list

      顯示版本范圍

      git show-branch

      顯示分支列表及拓?fù)潢P(guān)系

      git show-ref

      顯示本地引用

      git symbolic-ref

      顯示或者設(shè)置符號(hào)引用

      git update-ref

      更新引用的指向

      git verify-tag

      校驗(yàn) GPG 簽名的Tag

      4、版本庫(kù)管理相關(guān)命令

      命令

      簡(jiǎn)要說(shuō)明

      git count-objects

      顯示松散對(duì)象的數(shù)量和磁盤(pán)占用

      git filter-branch

      版本庫(kù)重構(gòu)

      git fsck

      對(duì)象庫(kù)完整性檢查

      git fsck-objects*

      同義詞,等同于 git fsck

      git gc

      版本庫(kù)存儲(chǔ)優(yōu)化

      git index-pack

      從打包文件創(chuàng)建對(duì)應(yīng)的索引文件

      git lost-found*

      過(guò)時(shí),請(qǐng)使用 git fsck –lost-found 命令

      git pack-objects

      從標(biāo)準(zhǔn)輸入讀入對(duì)象ID,打包到文件

      git pack-redundant

      查找多余的 pack 文件

      git pack-refs

      將引用打包到 .git/packed-refs 文件中

      git prune

      從對(duì)象庫(kù)刪除過(guò)期對(duì)象

      git prune-packed

      將已經(jīng)打包的松散對(duì)象刪除

      git relink

      為本地版本庫(kù)中相同的對(duì)象建立硬連接

      git repack

      將版本庫(kù)未打包的松散對(duì)象打包

      git show-index

      讀取包的索引文件,顯示打包文件中的內(nèi)容

      git unpack-objects

      從打包文件釋放文件

      git verify-pack

      校驗(yàn)對(duì)象庫(kù)打包文件

      5、數(shù)據(jù)傳輸相關(guān)命令

      命令

      簡(jiǎn)要說(shuō)明

      git fetch-pack

      執(zhí)行 git fetch 或 git pull 命令時(shí)在本地執(zhí)行此命令,用于從其他版本庫(kù)獲取缺失的對(duì)象

      git receive-pack

      執(zhí)行 git push 命令時(shí)在遠(yuǎn)程執(zhí)行的命令,用于接受推送的數(shù)據(jù)

      git send-pack

      執(zhí)行 git push 命令時(shí)在本地執(zhí)行的命令,用于向其他版本庫(kù)推送數(shù)據(jù)

      git upload-archive

      執(zhí)行 git archive –remote 命令基于遠(yuǎn)程版本庫(kù)創(chuàng)建歸檔時(shí),遠(yuǎn)程版本庫(kù)執(zhí)行此命令傳送歸檔

      git upload-pack

      執(zhí)行 git fetch 或 git pull 命令時(shí)在遠(yuǎn)程執(zhí)行此命令,將對(duì)象打包、上傳

      6、郵件相關(guān)命令

      命令

      簡(jiǎn)要說(shuō)明

      git imap-send

      將補(bǔ)丁通過(guò) IMAP 發(fā)送

      git mailinfo

      從郵件導(dǎo)出提交說(shuō)明和補(bǔ)丁

      git mailsplit

      將 mbox 或 Maildir 格式郵箱中郵件逐一提取為文件

      git request-pull

      創(chuàng)建包含提交間差異和執(zhí)行PULL操作地址的信息

      git send-email

      發(fā)送郵件

      7、協(xié)議相關(guān)命令

      命令

      簡(jiǎn)要說(shuō)明

      git daemon

      實(shí)現(xiàn)Git協(xié)議

      git http-backend

      實(shí)現(xiàn)HTTP協(xié)議的CGI程序,支持智能HTTP協(xié)議

      git instaweb

      即時(shí)啟動(dòng)瀏覽器通過(guò) gitweb 瀏覽當(dāng)前版本庫(kù)

      git shell

      受限制的shell,提供僅執(zhí)行Git命令的SSH訪問(wèn)

      git update-server-info

      更新啞協(xié)議需要的輔助文件

      git http-fetch

      通過(guò)HTTP協(xié)議獲取版本庫(kù)

      git http-push

      通過(guò)HTTP/DAV協(xié)議推送

      git remote-ext

      由Git命令調(diào)用,通過(guò)外部命令提供擴(kuò)展協(xié)議支持

      git remote-fd

      由Git命令調(diào)用,使用文件描述符作為協(xié)議接口

      git remote-ftp

      由Git命令調(diào)用,提供對(duì)FTP協(xié)議的支持

      git remote-ftps

      由Git命令調(diào)用,提供對(duì)FTPS協(xié)議的支持

      git remote-http

      由Git命令調(diào)用,提供對(duì)HTTP協(xié)議的支持

      git remote-https

      由Git命令調(diào)用,提供對(duì)HTTPS協(xié)議的支持

      git remote-testgit

      協(xié)議擴(kuò)展示例腳本

      8、版本庫(kù)轉(zhuǎn)換和交互相關(guān)命令

      命令

      簡(jiǎn)要說(shuō)明

      git archimport

      導(dǎo)入Arch版本庫(kù)到Git

      git bundle

      提交打包和解包,以便在不同版本庫(kù)間傳遞

      git cvsexportcommit

      將Git的一個(gè)提交作為一個(gè)CVS檢出

      git cvsimport

      導(dǎo)入CVS版本庫(kù)到Git?;蛘呤褂?cvs2git

      git cvsserver

      Git的CVS協(xié)議模擬器,可供CVS命令訪問(wèn)Git版本庫(kù)

      git fast-export

      將提交導(dǎo)出為 git-fast-import 格式

      git fast-import

      其他版本庫(kù)遷移至Git的通用工具

      git svn

      Git 作為前端操作 Subversion

      9、合并相關(guān)的輔助命令

      命令

      簡(jiǎn)要說(shuō)明

      git merge-base

      供其他腳本調(diào)用,找到兩個(gè)或多個(gè)提交最近的共同祖先

      git merge-file

      針對(duì)文件的兩個(gè)不同版本執(zhí)行三向文件合并

      git merge-index

      對(duì)index中的沖突文件調(diào)用指定的沖突解決工具

      git merge-octopus

      合并兩個(gè)以上分支。參見(jiàn) git merge 的octopus合并策略

      git merge-one-file

      由 git merge-index 調(diào)用的標(biāo)準(zhǔn)輔助程序

      git merge-ours

      合并使用本地版本,拋棄他人版本。參見(jiàn) git merge 的ours合并策略

      git merge-recursive

      針對(duì)兩個(gè)分支的三向合并。參見(jiàn) git merge 的recursive合并策略

      git merge-resolve

      針對(duì)兩個(gè)分支的三向合并。參見(jiàn) git merge 的resolve合并策略

      git merge-subtree

      子樹(shù)合并。參見(jiàn) git merge 的 subtree 合并策略

      git merge-tree

      顯式三向合并結(jié)果,不改變暫存區(qū)

      git fmt-merge-msg

      供執(zhí)行合并操作的腳本調(diào)用,用于創(chuàng)建一個(gè)合并提交說(shuō)明

      git rerere

      重用所記錄的沖突解決方案

      10、 雜項(xiàng)

      命令

      簡(jiǎn)要說(shuō)明

      git bisect–helper

      由 git bisect 命令調(diào)用,確認(rèn)二分查找進(jìn)度

      git check-attr

      顯示某個(gè)文件是否設(shè)置了某個(gè)屬性

      git checkout-index

      從暫存區(qū)拷貝文件至工作區(qū)

      git cherry

      查找沒(méi)有合并到上游的提交

      git diff-files

      比較暫存區(qū)和工作區(qū),相當(dāng)于 git diff –raw

      git diff-index

      比較暫存區(qū)和版本庫(kù),相當(dāng)于 git diff –cached –raw

      git diff-tree

      比較兩個(gè)樹(shù)對(duì)象,相當(dāng)于 git diff –raw A B

      git difftool–helper

      由 git difftool 命令調(diào)用,默認(rèn)要使用的差異比較工具

      git get-tar-commit-id

      從 git archive 創(chuàng)建的 tar 包中提取提交ID

      git gui–askpass

      命令 git gui 的獲取用戶(hù)口令輸入界面

      git notes

      提交評(píng)論管理

      git patch-id

      補(bǔ)丁過(guò)濾行號(hào)和空白字符后生成補(bǔ)丁唯一ID

      git quiltimport

      將Quilt補(bǔ)丁列表應(yīng)用到當(dāng)前分支

      git replace

      提交替換

      git shortlog

      對(duì) git log 的匯總輸出,適合于產(chǎn)品發(fā)布說(shuō)明

      git stripspace

      刪除空行,供其他腳本調(diào)用

      git submodule

      子模組管理

      git tar-tree

      過(guò)時(shí)命令,請(qǐng)使用 git archive

      git var

      顯示 Git 環(huán)境變量

      git web–browse

      啟動(dòng)瀏覽器以查看目錄或文件

      git whatchanged

      顯示提交歷史及每次提交的改動(dòng)

      git-mergetool–lib

      包含于其他腳本中,提供合并/差異比較工具的選擇和執(zhí)行

      git-parse-remote

      包含于其他腳本中,提供操作遠(yuǎn)程版本庫(kù)的函數(shù)

      git-sh-setup

      包含于其他腳本中,提供 shell 編程的函數(shù)庫(kù)

      下面腳本之家小編特為大家分享一個(gè)圖片版的

      Git 常用命令速查表。點(diǎn)擊查看大圖。

      介紹Git 常用命令大全

      Git命令參考手冊(cè)(文本版)

      git init # 初始化本地git倉(cāng)庫(kù)(創(chuàng)建新倉(cāng)庫(kù))
      git config –global user.name "xxx" # 配置用戶(hù)名
      git config –global user.email "xxx@xxx.com" # 配置郵件
      git config –global color.ui true # git status等命令自動(dòng)著色
      git config –global color.status auto
      git config –global color.diff auto
      git config –global color.branch auto
      git config –global color.interactive auto
      git clone git+ssh://git@192.168.53.168/VT.git # clone遠(yuǎn)程倉(cāng)庫(kù)
      git status # 查看當(dāng)前版本狀態(tài)(是否修改)
      git add xyz # 添加xyz文件至index
      git add . # 增加當(dāng)前子目錄下所有更改過(guò)的文件至index
      git commit -m 'xxx' # 提交
      git commit –amend -m 'xxx' # 合并上一次提交(用于反復(fù)修改)
      git commit -am 'xxx' # 將add和commit合為一步
      git rm xxx # 刪除index中的文件
      git rm -r * # 遞歸刪除
      git log # 顯示提交日志
      git log -1 # 顯示1行日志 -n為n行
      git log -5
      git log –stat # 顯示提交日志及相關(guān)變動(dòng)文件
      git log -p -m
      git show dfb02e6e4f2f7b573337763e5c0013802e392818 # 顯示某個(gè)提交的詳細(xì)內(nèi)容
      git show dfb02 # 可只用commitid的前幾位
      git show HEAD # 顯示HEAD提交日志
      git show HEAD^ # 顯示HEAD的父(上一個(gè)版本)的提交日志 ^^為上兩個(gè)版本 ^5為上5個(gè)版本
      git tag # 顯示已存在的tag
      git tag -a v2.0 -m 'xxx' # 增加v2.0的tag
      git show v2.0 # 顯示v2.0的日志及詳細(xì)內(nèi)容
      git log v2.0 # 顯示v2.0的日志
      git diff # 顯示所有未添加至index的變更
      git diff –cached # 顯示所有已添加index但還未commit的變更
      git diff HEAD^ # 比較與上一個(gè)版本的差異
      git diff HEAD — ./lib # 比較與HEAD版本lib目錄的差異
      git diff origin/master..master # 比較遠(yuǎn)程分支master上有本地分支master上沒(méi)有的
      git diff origin/master..master –stat # 只顯示差異的文件,不顯示具體內(nèi)容
      git remote add origin git+ssh://git@192.168.53.168/VT.git # 增加遠(yuǎn)程定義(用于push/pull/fetch)
      git branch # 顯示本地分支
      git branch –contains 50089 # 顯示包含提交50089的分支
      git branch -a # 顯示所有分支
      git branch -r # 顯示所有原創(chuàng)分支
      git branch –merged # 顯示所有已合并到當(dāng)前分支的分支
      git branch –no-merged # 顯示所有未合并到當(dāng)前分支的分支
      git branch -m master master_copy # 本地分支改名
      git checkout -b master_copy # 從當(dāng)前分支創(chuàng)建新分支master_copy并檢出
      git checkout -b master master_copy # 上面的完整版
      git checkout features/performance # 檢出已存在的features/performance分支
      git checkout –track hotfixes/BJVEP933 # 檢出遠(yuǎn)程分支hotfixes/BJVEP933并創(chuàng)建本地跟蹤分支
      git checkout v2.0 # 檢出版本v2.0
      git checkout -b devel origin/develop # 從遠(yuǎn)程分支develop創(chuàng)建新本地分支devel并檢出
      git checkout — README # 檢出head版本的README文件(可用于修改錯(cuò)誤回退)
      git merge origin/master # 合并遠(yuǎn)程master分支至當(dāng)前分支
      git cherry-pick ff44785404a8e # 合并提交ff44785404a8e的修改
      git push origin master # 將當(dāng)前分支push到遠(yuǎn)程master分支
      git push origin :hotfixes/BJVEP933 # 刪除遠(yuǎn)程倉(cāng)庫(kù)的hotfixes/BJVEP933分支
      git push –tags # 把所有tag推送到遠(yuǎn)程倉(cāng)庫(kù)
      git fetch # 獲取所有遠(yuǎn)程分支(不更新本地分支,另需merge)
      git fetch –prune # 獲取所有原創(chuàng)分支并清除服務(wù)器上已刪掉的分支
      git pull origin master # 獲取遠(yuǎn)程分支master并merge到當(dāng)前分支
      git mv README README2 # 重命名文件README為README2
      git reset –hard HEAD # 將當(dāng)前版本重置為HEAD(通常用于merge失敗回退)
      git rebase
      git branch -d hotfixes/BJVEP933 # 刪除分支hotfixes/BJVEP933(本分支修改已合并到其他分支)
      git branch -D hotfixes/BJVEP933 # 強(qiáng)制刪除分支hotfixes/BJVEP933
      git ls-files # 列出git index包含的文件
      git show-branch # 圖示當(dāng)前分支歷史
      git show-branch –all # 圖示所有分支歷史
      git whatchanged # 顯示提交歷史對(duì)應(yīng)的文件修改
      git revert dfb02e6e4f2f7b573337763e5c0013802e392818 # 撤銷(xiāo)提交dfb02e6e4f2f7b573337763e5c0013802e392818
      git ls-tree HEAD # 內(nèi)部命令:顯示某個(gè)git對(duì)象
      git rev-parse v2.0 # 內(nèi)部命令:顯示某個(gè)ref對(duì)于的SHA1 HASH
      git reflog # 顯示所有提交,包括孤立節(jié)點(diǎn)
      git show HEAD@{5}
      git show master@{yesterday} # 顯示master分支昨天的狀態(tài)
      git log –pretty=format:'%h %s' –graph # 圖示提交日志
      git show HEAD~3
      git show -s –pretty=raw 2be7fcb476
      git stash # 暫存當(dāng)前修改,將所有至為HEAD狀態(tài)
      git stash list # 查看所有暫存
      git stash show -p stash@{0} # 參考第一次暫存
      git stash apply stash@{0} # 應(yīng)用第一次暫存
      git grep "delete from" # 文件中搜索文本“delete from”
      git grep -e '#define' –and -e SORT_DIRENT
      git gc
      git fsck

      Git 是一個(gè)很強(qiáng)大的分布式版本控制系統(tǒng)。它不但適用于管理大型開(kāi)源軟件的源代碼,管理私人的文檔和源代碼也有很多優(yōu)勢(shì)。

      Git常用操作命令:

      1) 遠(yuǎn)程倉(cāng)庫(kù)相關(guān)命令

      檢出倉(cāng)庫(kù):$ git clone git://github.com/jquery/jquery.git

      查看遠(yuǎn)程倉(cāng)庫(kù):$ git remote -v

      添加遠(yuǎn)程倉(cāng)庫(kù):$ git remote add [name] [url]

      刪除遠(yuǎn)程倉(cāng)庫(kù):$ git remote rm [name]

      修改遠(yuǎn)程倉(cāng)庫(kù):$ git remote set-url –push [name] [newUrl]

      拉取遠(yuǎn)程倉(cāng)庫(kù):$ git pull [remoteName] [localBranchName]

      推送遠(yuǎn)程倉(cāng)庫(kù):$ git push [remoteName] [localBranchName]

      *如果想把本地的某個(gè)分支test提交到遠(yuǎn)程倉(cāng)庫(kù),并作為遠(yuǎn)程倉(cāng)庫(kù)的master分支,或者作為另外一個(gè)名叫test的分支,如下:

      $git push origin test:master // 提交本地test分支作為遠(yuǎn)程的master分支

      $git push origin test:test // 提交本地test分支作為遠(yuǎn)程的test分支

      2)分支(branch)操作相關(guān)命令

      查看本地分支:$ git branch

      查看遠(yuǎn)程分支:$ git branch -r

      創(chuàng)建本地分支:$ git branch [name] —-注意新分支創(chuàng)建后不會(huì)自動(dòng)切換為當(dāng)前分支

      切換分支:$ git checkout [name]

      創(chuàng)建新分支并立即切換到新分支:$ git checkout -b [name]

      刪除分支:$ git branch -d [name] —- -d選項(xiàng)只能刪除已經(jīng)參與了合并的分支,對(duì)于未有合并的分支是無(wú)法刪除的。如果想強(qiáng)制刪除一個(gè)分支,可以使用-D選項(xiàng)

      合并分支:$ git merge [name] —-將名稱(chēng)為[name]的分支與當(dāng)前分支合并

      創(chuàng)建遠(yuǎn)程分支(本地分支push到遠(yuǎn)程):$ git push origin [name]

      刪除遠(yuǎn)程分支:$ git push origin :heads/[name] 或 $ gitpush origin :[name]

      *創(chuàng)建空的分支:(執(zhí)行命令之前記得先提交你當(dāng)前分支的修改,否則會(huì)被強(qiáng)制刪干凈沒(méi)得后悔)

      $git symbolic-ref HEAD refs/heads/[name]

      $rm .git/index

      $git clean -fdx

      3)版本(tag)操作相關(guān)命令

      查看版本:$ git tag

      創(chuàng)建版本:$ git tag [name]

      刪除版本:$ git tag -d [name]

      查看遠(yuǎn)程版本:$ git tag -r

      創(chuàng)建遠(yuǎn)程版本(本地版本push到遠(yuǎn)程):$ git push origin [name]

      刪除遠(yuǎn)程版本:$ git push origin :refs/tags/[name]

      合并遠(yuǎn)程倉(cāng)庫(kù)的tag到本地:$ git pull origin –tags

      上傳本地tag到遠(yuǎn)程倉(cāng)庫(kù):$ git push origin –tags

      創(chuàng)建帶注釋的tag:$ git tag -a [name] -m 'yourMessage'

      4) 子模塊(submodule)相關(guān)操作命令

      添加子模塊:$ git submodule add [url] [path]

      如:$git submodule add git://github.com/soberh/ui-libs.git src/main/webapp/ui-libs

      初始化子模塊:$ git submodule init —-只在首次檢出倉(cāng)庫(kù)時(shí)運(yùn)行一次就行

      更新子模塊:$ git submodule update —-每次更新或切換分支后都需要運(yùn)行一下

      刪除子模塊:(分4步走哦)

      1) $ git rm –cached [path]

      2) 編輯“.gitmodules”文件,將子模塊的相關(guān)配置節(jié)點(diǎn)刪除掉

      3) 編輯“ .git/config”文件,將子模塊的相關(guān)配置節(jié)點(diǎn)刪除掉

      4) 手動(dòng)刪除子模塊殘留的目錄

      5)忽略一些文件、文件夾不提交

      在倉(cāng)庫(kù)根目錄下創(chuàng)建名稱(chēng)為“.gitignore”的文件,寫(xiě)入不需要的文件夾名或文件,每個(gè)元素占一行即可,如

      target

      bin

      *.db

      =====================

      Git 常用命令

      git branch 查看本地所有分支
      git status 查看當(dāng)前狀態(tài)
      git commit 提交
      git branch -a 查看所有的分支
      git branch -r 查看本地所有分支
      git commit -am "init" 提交并且加注釋
      git remote add origin git@192.168.1.119:ndshow
      git push origin master 將文件給推到服務(wù)器上
      git remote show origin 顯示遠(yuǎn)程庫(kù)origin里的資源
      git push origin master:develop
      git push origin master:hb-dev 將本地庫(kù)與服務(wù)器上的庫(kù)進(jìn)行關(guān)聯(lián)
      git checkout –track origin/dev 切換到遠(yuǎn)程dev分支
      git branch -D master develop 刪除本地庫(kù)develop
      git checkout -b dev 建立一個(gè)新的本地分支dev
      git merge origin/dev 將分支dev與當(dāng)前分支進(jìn)行合并
      git checkout dev 切換到本地dev分支
      git remote show 查看遠(yuǎn)程庫(kù)
      git add .
      git rm 文件名(包括路徑) 從git中刪除指定文件
      git clone git://github.com/schacon/grit.git 從服務(wù)器上將代碼給拉下來(lái)
      git config –list 看所有用戶(hù)
      git ls-files 看已經(jīng)被提交的
      git rm [file name] 刪除一個(gè)文件
      git commit -a 提交當(dāng)前repos的所有的改變
      git add [file name] 添加一個(gè)文件到git index
      git commit -v 當(dāng)你用-v參數(shù)的時(shí)候可以看commit的差異
      git commit -m "This is the message describing the commit" 添加commit信息
      git commit -a -a是代表add,把所有的change加到git index里然后再commit
      git commit -a -v 一般提交命令
      git log 看你commit的日志
      git diff 查看尚未暫存的更新
      git rm a.a 移除文件(從暫存區(qū)和工作區(qū)中刪除)
      git rm –cached a.a 移除文件(只從暫存區(qū)中刪除)
      git commit -m "remove" 移除文件(從Git中刪除)
      git rm -f a.a 強(qiáng)行移除修改后文件(從暫存區(qū)和工作區(qū)中刪除)
      git diff –cached 或 $ git diff –staged 查看尚未提交的更新
      git stash push 將文件給push到一個(gè)臨時(shí)空間中
      git stash pop 將文件從臨時(shí)空間pop下來(lái)
      ———————————————————
      git remote add origin git@github.com:username/Hello-World.git
      git push origin master 將本地項(xiàng)目給提交到服務(wù)器中
      ———————————————————–
      git pull 本地與服務(wù)器端同步
      —————————————————————–
      git push (遠(yuǎn)程倉(cāng)庫(kù)名) (分支名) 將本地分支推送到服務(wù)器上去。
      git push origin serverfix:awesomebranch
      ——————————————————————
      git fetch 相當(dāng)于是從遠(yuǎn)程獲取最新版本到本地,不會(huì)自動(dòng)merge
      git commit -a -m "log_message" (-a是提交所有改動(dòng),-m是加入log信息) 本地修改同步至服務(wù)器端 :
      git branch branch_0.1 master 從主分支master創(chuàng)建branch_0.1分支
      git branch -m branch_0.1 branch_1.0 將branch_0.1重命名為branch_1.0
      git checkout branch_1.0/master 切換到branch_1.0/master分支
      du -hs

      ———————————————————–
      mkdir WebApp
      cd WebApp
      git init
      touch README
      git add README
      git commit -m 'first commit'
      git remote add origin git@github.com:daixu/WebApp.git
      git push -u origin master

      Git 常用命令圖表

      介紹Git 常用命令大全

      贊(0)
      分享到: 更多 (0)
      網(wǎng)站地圖   滬ICP備18035694號(hào)-2    滬公網(wǎng)安備31011702889846號(hào)