Changes between Version 3 and Version 4 of waue/2011/1108


Ignore:
Timestamp:
Nov 8, 2011, 11:37:55 AM (12 years ago)
Author:
waue
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • waue/2011/1108

    v3 v4  
    11{{{
    22#!html
    3 <h1>git</h1>
    4 <h2>使用</h2>
     3<div style="text-align: center; color:#151B8D"><big style="font-weight: bold;"><big><big>
     4Git 修改
     5</big></big></big></div> <div style="text-align: center; color:#7E2217"><big style="font-weight: bold;"><big>
     6
     7</big></big></div>
    58
    69}}}
    7 [PageOutline]
    8 git
    9 
    10 [http://help.github.com/linux-set-up-git/]
    11 
    12 [http://billy3321.blogspot.com/2009/02/github-howto.html]
     10[[PageOutline]]
    1311
    1412 = 創建 repo =
     13
     14 * 在 [https://github.com/repositories/new] 上新增一個 repo
     15 * 開啟一個專案
     16{{{
     17  git config --global user.name "waue chen"
     18  git config --global user.email waue0920@gmail.com
     19  git init
     20  mkdir XXX
     21  cd XXX
     22  git init
     23  echo "hello world" > README
     24  git add README
     25  git commit -m 'first commit'
     26  git remote add origin git@github.com:waue0920/XXX.git
     27  git push -u origin master
     28
     29     
     30}}}
    1531
    1632
    1733 = 維護 repo =
    1834
    19 首先,開啟一個專案只要輸入
    20 {{{
    21     git init
    22 }}}
    2335
    2436
    25 再來,每次修改好了以後,可以先將修改存入stage
    26 
     37 * 修改存入stage
    2738{{{
    2839    git add <modified files>
    2940}}}
    3041
    31 
    32 若一次修改大量檔案,可以將所有檔案修改都add進去stage
     42 * 修改大量檔案
    3343{{{
    3444    git add .
     
    3646
    3747
    38 之後commit提交一次的修改
     48 * commit提交
    3949{{{
    4050    git commit -m "註解"
    4151}}}
    42 
    4352
    4453另外也可以把git add與git commit用一個指令完成
     
    4756}}}
    4857
    49 
    5058git特別的一點是,他可以在本地端開啟並使用。上面這些用法完全不用伺服器,本機就可以執行。
    51 
    5259本地端會有自己的repo,可以在飛機上,各種沒有網路的地方都可以順利使用並提交任何變更。
    53 
    5460等您覺得修改好了,可以放上伺服器的時候,確保網路連線並輸入
     61 * 本地 --> 伺服器
    5562{{{
    5663    git push
    5764}}}
    58 
    59 
    60 就可以將這邊的檔案與變更提交到github上面。
    61 如果您在github上的版本較新,也可以輸入
     65 * 伺服器 --> 本地
    6266{{{
    6367    git pull
     
    6569
    6670
    67 更新本地端的repo。
     71
     72
     73
     74 = ref =
     75[http://help.github.com/linux-set-up-git/]
     76
     77[http://billy3321.blogspot.com/2009/02/github-howto.html]