git 用法 - Linux

By Sierra Rose
at 2012-07-20T16:14
at 2012-07-20T16:14
Table of Contents
※ 引述《shihyu (shihyu)》之銘言:
: git status 可以查出變動的檔案
: 那有辦法把到這些變動檔案copy到某個資料夾嗎?
: 謝謝
$ git log
commit c4f168cee7ee1ce5abe17695f212923e1b3bdf79
Author: <[email protected]>
Date: Thu Jul 19 16:27:11 2012 +0800
edit README.txt
commit 0ad97e9255ad49441cce62d7235e4c986a3fc80d
Author: <[email protected]>
Date: Thu Jul 19 16:25:17 2012 +0800
add README.txt
commit 89847b0ca4b471b6cske900b6f68b940b52cb572
Author: <[email protected]>
Date: Thu Jul 19 15:23:23 2012 +0800
Init commit
假設在0ad97e925這次commit增加了README.txt這個檔案並寫入了一些內容
然後做了一些修改後又做了一次commit(即c4f168cee)
這時候如果想要取回第一次的README版本 使用checkout
$ git checkout 0ad97e925 或是 git checkout HEAD^
// HEAD 目前所在的commit點
// HEAD^ HEAD再上一次的commit(即add這次)
// HEAD^^ HEAD^再上一次commit(即Init commit)
這時候整個目錄的檔案都會回到那一次commit時的狀態
就照一般處理檔案的方式複製一份到其他地方之類
把要的檔案拿回來以後只要
$ git checkout (這條branch名稱)
就會回到branch的最末端(這條branch最後一次commit的地方)
如果是想要做備份 只要把整個資料夾打包起來就可以了
反正有git在永遠可以取得舊版本
不知道是不是原PO要的
還請大家多多指教<(_ _)>
--
: git status 可以查出變動的檔案
: 那有辦法把到這些變動檔案copy到某個資料夾嗎?
: 謝謝
$ git log
commit c4f168cee7ee1ce5abe17695f212923e1b3bdf79
Author: <[email protected]>
Date: Thu Jul 19 16:27:11 2012 +0800
edit README.txt
commit 0ad97e9255ad49441cce62d7235e4c986a3fc80d
Author: <[email protected]>
Date: Thu Jul 19 16:25:17 2012 +0800
add README.txt
commit 89847b0ca4b471b6cske900b6f68b940b52cb572
Author: <[email protected]>
Date: Thu Jul 19 15:23:23 2012 +0800
Init commit
假設在0ad97e925這次commit增加了README.txt這個檔案並寫入了一些內容
然後做了一些修改後又做了一次commit(即c4f168cee)
這時候如果想要取回第一次的README版本 使用checkout
$ git checkout 0ad97e925 或是 git checkout HEAD^
// HEAD 目前所在的commit點
// HEAD^ HEAD再上一次的commit(即add這次)
// HEAD^^ HEAD^再上一次commit(即Init commit)
這時候整個目錄的檔案都會回到那一次commit時的狀態
就照一般處理檔案的方式複製一份到其他地方之類
把要的檔案拿回來以後只要
$ git checkout (這條branch名稱)
就會回到branch的最末端(這條branch最後一次commit的地方)
如果是想要做備份 只要把整個資料夾打包起來就可以了
反正有git在永遠可以取得舊版本
不知道是不是原PO要的
還請大家多多指教<(_ _)>
--
Tags:
Linux
All Comments
Related Posts
請問 git 適當的工作流程

By Dora
at 2012-07-20T14:58
at 2012-07-20T14:58
請問如何同時使用無線網路跟有線網路?

By Hedda
at 2012-07-20T00:54
at 2012-07-20T00:54
git 用法

By Ophelia
at 2012-07-19T23:26
at 2012-07-19T23:26
關於busybox的mdev功能

By Doris
at 2012-07-19T18:48
at 2012-07-19T18:48
$4 - Python GTK+ 3 Tutorial

By Eden
at 2012-07-18T23:29
at 2012-07-18T23:29