初コミット
$ mkdir ybase
$ cd ybase/
$ git init
Initialized empty Git repository in /Applications/MAMP/htdocs/ybase/.git/
$ touch README
$ git add README
$ git commit
[master (root-commit) 11b70d2] githubチュートリアル通りに初コミット
0 files changed, 0 insertions(+), 0 deletions(-)
create mode 100644 README
$ git remote add origin git@github.com:iphlox/ybase.git
$ git push origin master
Counting objects: 3, done.
Writing objects: 100% (3/3), 250 bytes, done.
Total 3 (delta 0), reused 0 (delta 0)
To git@github.com:iphlox/ybase.git
* [new branch] master -> master
展開
$ cd htdocs
$ unzip cakephp-cakephp1x-fc6802b.zip
Archive: cakephp-cakephp1x-fc6802b.zip
edf2ea1e741a554a8de069fd17122f850b46f85e
creating: cakephp-cakephp1x-fc6802b/
...
$ cp -r cakephp-cakephp1x-fc6802b/* ybase/
$ cp -r cakephp-cakephp1x-fc6802b/.htaccess ybase/
$ cd ybase/
作業前にブランチしておく
$ git branch installCakephp
$ git branch
installCakephp
* master
$ git checkout installCakephp
M README
Switched to branch 'installCakephp'
$ git branch
* installCakephp
master
- git checkout -b installCakephpで一発
git管理下に置きコミット
$ git add app
$ git add cake
$ git add plugins
$ git add vendors
$ git add index.php
$ git add .htaccess
$ git commit
[installCakephp a1d084d] cakephp1.3.0-RC2を配置
669 files changed, 190259 insertions(+), 0 deletions(-)
create mode 100644 .htaccess
...
$ git push origin installCakephp
Counting objects: 916, done.
Delta compression using up to 2 threads.
Compressing objects: 100% (785/785), done.
Writing objects: 100% (915/915), 1.05 MiB | 1.84 MiB/s, done.
Total 915 (delta 326), reused 0 (delta 0)
To git@github.com:iphlox/ybase.git
* [new branch] installCakephp -> installCakephp
READMEもadd
- READMEが更新されなかった理由はよくわからないけどaddしとく
$ git add README
$ git commit
[installCakephp 024dff6] READMEもaddしておく
1 files changed, 34 insertions(+), 0 deletions(-)
$ git push origin installCakephp
Counting objects: 5, done.
Delta compression using up to 2 threads.
Compressing objects: 100% (3/3), done.
Writing objects: 100% (3/3), 896 bytes, done.
Total 3 (delta 1), reused 0 (delta 0)
To git@github.com:iphlox/ybase.git
a1d084d..024dff6 installCakephp -> installCakephp
/app/config/core.phpはgit rmしちゃう
- Security.saltとSecurity.cipherSeedを記述したものを公開するのはヤバイので
- /app/config/database.phpはgit addしない
- githubにはダミーファイルを置いておくのが良いのか?database.php.defaultみたいに
$ cd app/config/
$ ls
acl.ini.php core.php routes.php
bootstrap.php database.php.default schema
$ cp core.php core.php.default
$ cp database.php.default database.php
$ ls
acl.ini.php core.php.default routes.php
bootstrap.php database.php schema
core.php database.php.default
$ git rm core.php
rm 'app/config/core.php'
$ git add core.php.default
$ cp core.php.default core.php
$ git status
# On branch installCakephp
# Changes to be committed:
# (use "git reset HEAD <file>..." to unstage)
#
# renamed: core.php -> core.php.default
#
# Untracked files:
# (use "git add <file>..." to include in what will be committed)
#
# .DS_Store
# core.php
# database.php
# ../tmp/cache/persistent/cake_core_default_jpn
# ../tmp/cache/persistent/cake_core_dir_map
# ../tmp/cache/persistent/cake_core_file_map
# ../tmp/cache/persistent/cake_core_object_map
# ../tmp/logs/debug.log
$ git commit
[installCakephp 874f7c6] core.phpはcore.php.defaultに改名、git管理外に。database.php.defaultを複製、database.phpはgit管理外に。
1 files changed, 0 insertions(+), 0 deletions(-)
rename app/config/{core.php => core.php.default} (100%)
$ git push origin installCakephp
Counting objects: 7, done.
Delta compression using up to 2 threads.
Compressing objects: 100% (4/4), done.
Writing objects: 100% (4/4), 431 bytes, done.
Total 4 (delta 3), reused 0 (delta 0)
To git@github.com:iphlox/ybase.git
024dff6..874f7c6 installCakephp -> installCakephp
- git rm core.phpするとファイルが消されるのか。cp core.php.default core.phpで書き戻し。
- git statusでcore.phpとdatabase.phpが管理外になってるのを確認
使えるgitコマンド
git commit
- オプションなしでviが動くのでコメント書いて:wqで抜ける
git checkout -b installCakephp