トップ 一覧 検索 ヘルプ RSS ログイン

劇場

劇場>>Gitメモの変更点

  • 追加された行はこのように表示されます。
  • 削除された行はこのように表示されます。
{{outline}}

!!git 設定
*エイリアスを設定しておくと幸せになれるかも
*&その他設定
""net stop beep #windows用
""git config --global alias.b branch
""git config --global alias.s status
""git config --global alias.st status
""git config --global alias.ci commit
""git config --global alias.co checkout
""git config --global user.name "username"
""git config --global user.email "mailaddress"
""git config --global core.editor vim
""git config --global core.pager 'less -r'
""git config --global push.default current
""git config --global color.ui auto
**http://d.hatena.ne.jp/sugyan/20100507/1273209155
*レポジトリごとの設定でよくやること
**vim .gitignore
""*.swp
""*.cache
""*.tmp
""test*
"".gitignore
.gitignoreをignoreするかどうかは場合によりけり
!!さくらでgit使う場合のメモ
*remoteの設定が複雑なので調べた事を残しておく
!シンボリックリンク(new)
*下のcshの場合、zshの場合、ローカルでの対応が全部要らない簡単な方法があったみたいorz
*さくらインターネットをgitの共用リポジトリにする方法 - Dive into the Tech World!
*http://d.hatena.ne.jp/shiba1029196473/20100324/1269406164
""[server]$ ln -s /home/username/local/git/bin /home/username/bin
*自分の場合はgitのインストール場所が違ったのでそれに合わせてリンク作成
""$ ln -s /home/account/local/bin /home/account/bin


!cshの場合
*http://apple-tart.net/dokuwiki/doku.php?id=development_tool:vc:git

""まず、さくらインターネットをリモートリポジトリとして使う場合は下記のようなエラーがでて動かないので
""
""git-receive-pack: Command not found.
""fatal: The remote end hung up unexpectedly
""
""解決方法として.chrcにgitのパスを通す必要があります。
""
""set path=($path $HOME/local/bin )

!zshの場合
*http://d.hatena.ne.jp/milk1000cc/20091009/1255052655
""PATH=$HOME/local/bin:$PATH
*git経由でsshアクセスする場合.zshrcまで読まれず、.zshenvだけになる
*参考: http://journal.mycom.co.jp/column/zsh/001/index.html

!ローカル側での対応する場合
*remoteでの対策でうまくいかなかったので
*http://text.tklabo.net/blog/9
""[alias]
""    spush = push --receive-pack=/home/username/local/git/bin/git-receive-pack
""    sclone = clone --upload-pack=/home/username/local/git/bin/git-upload-pack
""    spush = push --upload-pack=/home/username/local/git/bin/git-upload-pack


!remote repositryの作成注意点
""pushするためのremote repositryは--bareつけて作るべし
*適当に作ったレポジトリにpushしようとしたら
""Counting objects: 4, done.
""Delta compression using up to 2 threads.
""Compressing objects: 100% (2/2), done.
""Writing objects: 100% (3/3), 344 bytes, done.
""Total 3 (delta 0), reused 0 (delta 0)
""error: refusing to update checked out branch: refs/heads/master
""error: By default, updating the current branch in a non-bare repository
""error: is denied, because it will make the index and work tree inconsistent
""error: with what you pushed, and will require 'git reset --hard' to match
""error: the work tree to HEAD.
""error: 
""error: You can set 'receive.denyCurrentBranch' configuration variable to
""error: 'ignore' or 'warn' in the remote repository to allow pushing into
""error: its current branch; however, this is not recommended unless you
""error: arranged to update its work tree to match what you pushed in some
""error: other way.
""error: 
""error: To squelch this message and still keep the default behaviour, set
""error: 'receive.denyCurrentBranch' configuration variable to 'refuse'.

こんな感じのエラーが出てpushできなかった.

この辺が原因

*Hgに慣れてしまった人のためのGitメモCommentsAdd Star
*http://d.hatena.ne.jp/kuenishi/20091226/1261820285
""で、なんのこっちゃらと思ったら、push先がbareになっていないのが悪いらしい。
""---------------------
""    If you're creating a repo that people are going to want to push to, then you should create it using git init --bare (and git init --bare --shared if several user accounts need access to it), or git clone --bare if you're creating it by cloning an existing repo.
""---------------------
""つまり、みんなでpushするレポジトリがあったら、そいつをbareなものにしておけば、bareなものに対するpushにはこの気持ち悪い警告は出ない。

!gitでローカルとサーバーとの環境構築
*構築例のようなもの
*http://text.tklabo.net/blog/tags/git

!自分の開発環境めも
*【追記】シンボリックリンクを設定したのでsclone,spush,spullではなく通常のコマンドでおk

*本番repositry:/home/account/www
*bare-repositry:/home/account/git/www.git
*開発repositry:localMAC:/Users/account/bsfactory/www
*準備
"">cd /home/account/git
"">git clone --bare /home/account/www
"">cd -
"">git remote add origin /home/account/git/www.git

*流れ
*MAC
"">cd /Users/account/git/bsfactory
"">git sclone ssh://account@server/home/account/git/www
"">vim {edit}
"">git commit -a
"">git spush
*remote
"">cd /home/account/www
"">git pull /home/account/git/www.git master
※sclone, spushは http://wiki.hituzi.jp/wiki.cgi?page=Git%A5%E1%A5%E2#p3 参照

!!MACでgit使う場合のメモ
*分散型バージョン管理システム「Git」Mac OS X インストール
*http://decide.cocolog-nifty.com/blog/2009/04/gitmac-os-x-773.html
*google codeにinstallerがあるのでそれを使う

!!rebase で本番用の設定と開発用の設定を簡単に切り替える
*http://d.hatena.ne.jp/bleis-tift/20100305/1267760000

!!TDD と Git についてメモ
*http://d.hatena.ne.jp/bleis-tift/20100217/1266378757

!!コミット時の表示
""git commit -a -s -v
"" s サインオフ。自分が著作権があるという署名。
"" v diffをもう一度確認できる。
*http://d.hatena.ne.jp/kinneko/20081004/p4
!!現在の修正をその2、3個前のcommitも含めてブランチで進めていた事にしたい場合
""git comit -a -m "temp"
""git branch dev1
""git reset --hard HEAD^^^
""git checkout dev1
""git reset HEAD^
!!zshでもbashと同じくらい快適にgit補完関数を使う
""さてgitのtarballにcontrib/completion/git-completion.bashというのがあるのはディープなgit使いならご存知かと思います。残念ながらファイル名の通りbashでしか使えませんでしたが、v1.7.4-rc0でzsh compatibleになりました
*http://uu59.blog103.fc2.com/blog-entry-5.html