真实的国产乱ⅩXXX66竹夫人,五月香六月婷婷激情综合,亚洲日本VA一区二区三区,亚洲精品一区二区三区麻豆

成都創(chuàng)新互聯(lián)網(wǎng)站制作重慶分公司

三、Git入門(mén)與基本使用(3)-創(chuàng)新互聯(lián)

11、分離頭指針情況下的注意事項(xiàng)
 所謂分離頭指針,即在git切換到某一commit時(shí),沒(méi)有綁定在分支或者tag上,此時(shí)如果在該commit下進(jìn)行了文件修改,并且提交commit時(shí),git在日后清理該提交而不保存,因此在進(jìn)行commit查看時(shí),最好綁定在某一branch或者tag上操作,當(dāng)然這種操作的好處也存在,即不會(huì)破壞原有的branch環(huán)境。

專(zhuān)業(yè)領(lǐng)域包括成都網(wǎng)站制作、網(wǎng)站設(shè)計(jì)、購(gòu)物商城網(wǎng)站建設(shè)、微信營(yíng)銷(xiāo)、系統(tǒng)平臺(tái)開(kāi)發(fā), 與其他網(wǎng)站設(shè)計(jì)及系統(tǒng)開(kāi)發(fā)公司不同,成都創(chuàng)新互聯(lián)的整合解決方案結(jié)合了幫做網(wǎng)絡(luò)品牌建設(shè)經(jīng)驗(yàn)和互聯(lián)網(wǎng)整合營(yíng)銷(xiāo)的理念,并將策略和執(zhí)行緊密結(jié)合,為客戶提供全網(wǎng)互聯(lián)網(wǎng)整合方案。
$ git checkout 0bd98cb5d0d969cfc35d   #直接切換到commit上
Note: checking out '0bd98cb5d0d969cfc35d'.

You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by performing another checkout.

If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -b with the checkout command again. Example:

  git checkout -b 

HEAD is now at 0bd98cb Add second file

$ git status                                        #此時(shí)狀態(tài),分離頭指針狀態(tài)
HEAD detached at 0bd98cb
nothing to commit, working tree clean

$ echo "Update second file " >> second.txt   #在分離頭指針狀態(tài)下,修改文件并提交

$ git commit -am"Update second file"
[detached HEAD 71faae4] Update second file
 1 file changed, 1 insertion(+)

 $ git checkout master
Warning: you are leaving 1 commit behind, not connected to
any of your branches:

  71faae4 Update second file

If you want to keep it by creating a new branch, this may be a good time
to do so with:

 git branch  71faae4

Switched to branch 'master'

$ gitk    #查看在分離頭指針下的提交,可以發(fā)現(xiàn)git沒(méi)有保存

三、Git入門(mén)與基本使用(3)

$ git branch newsecond 71faae4     #將修改的commit綁定到一個(gè)新的分支

$ gitk     #查看此時(shí)提交,可以發(fā)現(xiàn)git已經(jīng)保存剛才的commit

三、Git入門(mén)與基本使用(3)

12、進(jìn)一步理解HEAD和branch
 HEAD無(wú)論是在某一分支或者tag其,最終都會(huì)是在某一commit上。同時(shí)使用HEAD可以指代當(dāng)前的commit。

$ cat .git/refs/heads/temp
7376bc5b2ebc3e13d4c4552ebdef348a17cd4eef

$ git cat-file -t 7376bc5b2
commit

13、怎么刪除不需要的分支

$ git branch
  master
  newsecond
* temp

$ git branch -d newsecond
error: The branch 'newsecond' is not fully merged.
If you are sure you want to delete it, run 'git branch -D newsecond'.

$ git branch -D newsecond
Deleted branch newsecond (was 71faae4).

$ git branch
  master
* temp

14、怎么修改最新commit的message

$ git log -n1      #修改前
commit 7376bc5b2ebc3e13d4c4552ebdef348a17cd4eef (HEAD -> temp)
Author: Jone <764651475@qq.com>
Date:   Thu Mar 14 17:03:07 2019 +0800

    Update fourth file

$ git commit --amend                  #使用該命令進(jìn)入vim編輯界面直接修改即可
[temp 097d397] Update fourth file.txt
 Date: Thu Mar 14 17:03:07 2019 +0800
 1 file changed, 1 insertion(+)

$ git log -n1            #修改后
commit 097d397f672da771da95cf9baf49057047846617 (HEAD -> temp)
Author: Jone <764651475@qq.com>
Date:   Thu Mar 14 17:03:07 2019 +0800

    Update fourth file.txt

15、怎么修改老舊commit的message

$ git log -n3     #要修改導(dǎo)入第二個(gè)commit的message
commit 097d397f672da771da95cf9baf49057047846617 (HEAD -> temp)
Author: Jone <764651475@qq.com>
Date:   Thu Mar 14 17:03:07 2019 +0800

    Update fourth file.txt

commit 1d63ec82259b237f58e7525ccf856a03fb880fcd
Author: Jone <764651475@qq.com>
Date:   Thu Mar 14 17:01:46 2019 +0800

    Add fouth file

commit b843c287804d2b5886167740f9e6c0d327540ee1 (tag: 03tag)
Author: Jone <764651475@qq.com>
Date:   Thu Mar 14 17:00:21 2019 +0800

    Add third file

$ git rebase -i b843c287804d2b588616    #選擇倒數(shù)第二個(gè)commit的 base信息,即導(dǎo)入第三個(gè)commit
[detached HEAD bfd373a] Add fouth file.txt
 Date: Thu Mar 14 17:01:46 2019 +0800
 1 file changed, 1 insertion(+)
 create mode 100644 fourth.txt
Successfully rebased and updated refs/heads/temp.

第一張圖為需要修改的信息,將pick改為r即可
三、Git入門(mén)與基本使用(3)
第二張圖為修改后的commit 信息
三、Git入門(mén)與基本使用(3)

$ git log -n3     #查看修改后的message
commit ce587039661c88fd508035fd103a012e33c057ac (HEAD -> temp)
Author: Jone <764651475@qq.com>
Date:   Thu Mar 14 17:03:07 2019 +0800

    Update fourth file.txt

commit bfd373ab1dd5b2d578bac9cacd4d89d0066c51af
Author: Jone <764651475@qq.com>
Date:   Thu Mar 14 17:01:46 2019 +0800

    Add fouth file.txt

commit b843c287804d2b5886167740f9e6c0d327540ee1 (tag: 03tag)
Author: Jone <764651475@qq.com>
Date:   Thu Mar 14 17:00:21 2019 +0800

    Add third file

另外有需要云服務(wù)器可以了解下創(chuàng)新互聯(lián)scvps.cn,海內(nèi)外云服務(wù)器15元起步,三天無(wú)理由+7*72小時(shí)售后在線,公司持有idc許可證,提供“云服務(wù)器、裸金屬服務(wù)器、高防服務(wù)器、香港服務(wù)器、美國(guó)服務(wù)器、虛擬主機(jī)、免備案服務(wù)器”等云主機(jī)租用服務(wù)以及企業(yè)上云的綜合解決方案,具有“安全穩(wěn)定、簡(jiǎn)單易用、服務(wù)可用性高、性價(jià)比高”等特點(diǎn)與優(yōu)勢(shì),專(zhuān)為企業(yè)上云打造定制,能夠滿足用戶豐富、多元化的應(yīng)用場(chǎng)景需求。


網(wǎng)站名稱(chēng):三、Git入門(mén)與基本使用(3)-創(chuàng)新互聯(lián)
網(wǎng)站URL:http://weahome.cn/article/dpsege.html

其他資訊

在線咨詢

微信咨詢

電話咨詢

028-86922220(工作日)

18980820575(7×24)

提交需求

返回頂部