揮発性のメモ2

http://d.hatena.ne.jp/iww/

cvsからgitへのコマンドごとの読み替え

やること cvs git
リポジトリ置場 /var/lib/cvs /var/lib/git
インポート
(新規作成)
cd project
cvs import project vendor tagname
cd ../
rm -rf project
cvs co project
ssh user@server 'mkdir /var/lib/git/project.git
cd /var/lib/git/project.git
git init --bare'

cd project
git init
git add .
git commit
git remote add origin ssh://user@server/var/lib/git/project.git
git push --all
チェックアウト cvs co project git clone ssh://user@server/var/lib/git/project.git
未コミット分の
差分を見る
git fetch
git diff FETCH_HEAD
リモートとの
差分を見る
cvs diff git diff origin/master
リモートとコミット分との
差分を見る
git diff origin/master HEAD
差分ファイル一覧 cvs -nq update -P 2>/dev/null \
|egrep '^. '
・ローカル中心
git status -s
・リモート中心
git diff --name-status FETCH_HEAD
全ファイル一覧 cvs ls -lPR git ls-files -cdmokt --exclude-standard
アップデート cvs update git fetch
git merge FETCH_HEAD
ファイル追加 cvs add filename git add filename
ファイル削除 cvs remove filename git rm filename
ファイル変更を取消 cvs update -p filename > filename git checkout filename
ファイル毎コミット cvs commit filename git fetch
git add filename
git commit
git push
変更分全部コミット cvs commit git fetch
git commit -a
git push
コミット取消 git reset --soft HEAD^ *1
タグ一覧 cvs status -v 2>/dev/null \
|perl -nle'/^\t([^\s]+)/ && print $1' \
|sort |uniq
git tag
タグをつける cvs tag tagname git tag -a tagname *2
git push origin tagname
タグを外す cvs tag -d tagname git tag -d tagname
git push origin :refs/tags/tagname


~/.gitconfig

[user]
    name = unko
    email = unko@example.com
[core]
    pager = cat
    autocrlf = false
    safecrlf = true
    quotepath = false
    filemode = false    # ファイルの実行属性 falseで無視
[color]
    status = auto
    diff = auto
    branch = auto
    interactive = auto
    ui = auto
[color "diff"]
    whitespace = normal

[alias]
    ls = ls-files -cdmokt --exclude-standard
    alias = !"f(){ git config --get-regexp alias|perl -pe's/alias\\.//'|if [ -z $1 ];then cut -d' ' -f1|column; else grep $1' '; fi }; f"

*1:--softはファイルはそのまま、 HEAD^ はひとつ前

*2:うっかり-aを忘れた場合は軽量版タグになる。-dで外せる