顯示具有 git 標籤的文章。 顯示所有文章
顯示具有 git 標籤的文章。 顯示所有文章

2014年4月9日 星期三

Setup git server

以前在使用git的時候都是同事幫忙架設,這次剛好有機會順便紀錄一下

Git Server

1. 安裝必要套件

#  apt-get install git-core

2. 建立repository

假設所有的project都欲放置/opt/git 並且建立名為project1的git
a. # mkdir /opt/git
b. # mkdir /opt/git/project1
    # cd /opt/git/project1
    # git --bare init


Git Client

在使用者端,假設project的位置是~/projectA
# mkdir ~/projectA
# cd ~/projectA
# git init
# echo "project init">>init
# git add .
# git commit -m "init project"
# git remote add origin user@[IP]:/opt/git/project1
# git push origin master

2012年3月22日 星期四

repo 常用指令


  1. 取得source
    $ repo init -u [address] -b [branch]
  2. 更換remote branch
    $ repo init -b [branch]
  3. 建立/跳轉local branch
    $ repo start [branch] [dir]    or $ repo start --all [branch]
  4. 清除未進track的檔案
    $ repo forall -c git clean -fdD
  5. 清除未commit 檔案
    $ repo forall -c git reset --hard HEAD
  6. 取得 repository status
    $ repo status
  7. 清除未commit 檔案
    $ repo forall -c git reset --hard HEAD