[[PageOutline]] = Git = * [http://git-scm.com/book/ja/ Git - Book] * [http://git-scm.com/book/ja/Git-%E3%81%AE%E3%83%96%E3%83%A9%E3%83%B3%E3%83%81%E6%A9%9F%E8%83%BD-%E3%83%96%E3%83%A9%E3%83%B3%E3%83%81%E3%81%AE%E7%AE%A1%E7%90%86 3.3 Git のブランチ機能 - ブランチの管理] > 現在作業中のブランチにマージ済みのブランチを調べるには git branch –merged を実行します。 > まだマージされていない作業を持っているすべてのブランチを知るには、git branch --no-merged を実行します。 * [http://www8.atwiki.jp/git_jp/ Git入門 - トップページ] * [http://www.hyuki.com/techinfo/gitinit.html Gitの基礎練習] * [http://www.machu.jp/diary/20100506.html#p01 Subversion ユーザーが Git を使ってみた (基本操作編) - まちゅダイアリー(2010-05-06)] * Subversion使っている人間としては分かりやすい * [http://d.hatena.ne.jp/propella/20110105/p1 ファイルシステムとしての Git - 言語ゲーム] * twitter:suma90h/status/23299114481491968 * [http://d.hatena.ne.jp/idesaku/20091230/1262159267 git-cherry-pickを掘り下げる - idesaku blog] * twitter:random_oracle/status/24024533967044608 * [http://d.hatena.ne.jp/murank/20110320/1300619118 git diff の使い方がほんの少し理解できた - murankの日記] * [http://d.hatena.ne.jp/murank/20110327/1301224770 git reset についてもまとめてみる - murankの日記] * 図入りで説明 * [http://transitive.info/article/git/info/concept/ transitive.info - Git 考え方] > * キャレットとチルダ * {{{HEAD^}}}と{{{HEAD~}}}の違いなど * [http://d.hatena.ne.jp/kk_Ataka/20120410/1334058674 Pro Gitと入門Gitと入門gitでGitの復習 HEADのキャレットとかチルダとか補講編 - kk_Atakaの日記] * こちらも分かりやすい * [http://d.hatena.ne.jp/hokaccha/20120404/1333507076 git pullの詳細な挙動を追ってみる - hokaccha.hamalog v2] * [http://dqn.sakusakutto.jp/2012/11/git_pull.html Git pullを使うべきでない3つの理由 - DQNEO起業日記] * [http://stackoverflow.com/questions/3959924/whats-the-difference-between-git-clone-mirror-and-git-clone-bare What's the difference between git clone --mirror and git clone --bare - Stack Overflow] * 通常のclone, clone --bare, clone --mirrorの違いについて詳しく書かれている * [http://d.hatena.ne.jp/shim0mura/20120914/1347591103 gitのbareリポジトリのバックアップをとる - 馬鹿と天才は紙一重] > バックアップ用のリポジトリを作るのであれば--bareではなく--mirrorというオプションをつけます。 > {{{ > $ git clone --mirror yamucha chaoz > }}} > git-pullをすると、chaozはbareリポジトリだから管理ファイルしか存在しないためにmergeができないよと怒られます。なのでここではgit-fetchをしないといけません。 * [http://d.hatena.ne.jp/tyru/20110723/git_clone_mirror git clone --mirror - Humanity] > --mirrorは実際これと同じことをしてるっぽい(たぶん) > {{{ > $ git clone --bare {uri} > $ cd {dir} > $ git config remote.origin.fetch '+refs/*:refs/*' > $ git config remote.origin.url $uri > $ git config remote.origin.mirror true > }}} * [https://help.github.com/articles/duplicating-a-repository Duplicating a repository · GitHub Help] > {{{ > $ git clone --bare https://github.com/exampleuser/old-repo.git > $ cd old-repo.git > $ git push --mirror https://github.com/exampleuser/new-repo.git > }}} * [http://biokids.org/?%A4%C9%A4%D6%A4%AA%2F%B3%AB%C8%AF%A4%B7%A4%E8%A4%A6%A1%AA%2Fgit%A4%A4%A4%ED%A4%A4%A4%ED どぶお/開発しよう!/gitいろいろ - BioKids Wiki] > === GitHubにHTTPSでアクセスするとSSL証明書の検証に失敗する > この場合のように新たな証明書をOpenSSLへインストールする方法について解説したページが見つからなかったのでメモしておきます。 * [http://stackoverflow.com/questions/3777075/ssl-certificate-rejected-trying-to-access-github-over-https-behind-firewall git - SSL certificate rejected trying to access GitHub over HTTPS behind firewall - Stack Overflow] > {{{ > $ env GIT_SSL_NO_VERIFY=true git clone https://github... > }}} * [http://dqn.sakusakutto.jp/2012/11/git_export_archive_checkout_index.html Gitでexportするときはgit archiveとgit checkout-indexのどちらがよいか - DQNEO起業日記] > masterブランチをエクスポートしたいとします。 > {{{#!bash > mkdir /tmp/foo > git archive master | tar -x -C /tmp/foo > }}} > (必ず先に空のディレクトリを作っておきましょう。) * [http://wiki.livedoor.jp/deya4791/d/gitolite%20%A4%C8%20cgit gitolite と cgit - ひるね - Seesaa Wiki(ウィキ)] = git-svn = * [http://stackoverflow.com/questions/8333870/is-there-an-advantage-to-using-no-metadata-in-git-svn-clone Is there an advantage to using --no-metadata in git svn clone? - Stack Overflow] > This option is NOT recommended as it makes it difficult to track down old references to SVN revision numbers in existing documentation, bug reports and archives. * [http://blog.s21g.com/articles/618 git-svnでSVN上の複数のブランチやtrunkを扱う方法 - Hello, world! - s21g] * [http://stackoverflow.com/questions/1584675/converting-svn-to-git-how-to-get-the-branches-not-to-be-just-remote-in-the-svn Converting svn to git, how to get the branches not to be just remote in the svn repo? - Stack Overflow] == convert svn repos to git == * trunk/tags/branches -> -s オプションで拾える * vendor -> 手動でconfig --addしてfetch * リモートブランチをローカルブランチへ変更する 1. mitty@test:~/works$ git svn init -s http://lab.mitty.jp/svn/lab/ lab {{{ Initialized empty Git repository in /home/mitty/works/lab/.git/ }}} 1. mitty@test:~/works/lab (master)$ cat .git/config {{{ [core] repositoryformatversion = 0 filemode = true bare = false logallrefupdates = true [svn-remote "svn"] url = http://lab.mitty.jp/svn/lab fetch = trunk:refs/remotes/trunk branches = branches/*:refs/remotes/* tags = tags/*:refs/remotes/tags/* }}} 1. mitty@test:~/works/lab (master)$ git config --add svn-remote.svn.fetch "vendor:refs/remotes/vendor" {{{ [core] repositoryformatversion = 0 filemode = true bare = false logallrefupdates = true [svn-remote "svn"] url = http://lab.mitty.jp/svn/lab fetch = trunk:refs/remotes/trunk branches = branches/*:refs/remotes/* tags = tags/*:refs/remotes/tags/* fetch = vendor:refs/remotes/vendor }}} 1. mitty@test:~/works/lab (master)$ git svn fetch {{{ Checked out HEAD: http://lab.mitty.jp/svn/lab/trunk r204 creating empty directory: TipAndDoc/tools/trac/plugins }}} * mitty@test:~/works/lab (master)$ ls -1F {{{ Commentary/ Dev/ misc/ TipAndDoc/ }}} * mitty@test:~/works/lab (master)$ git tag -l * mitty@test:~/works/lab (master)$ git br -a {{{ * master remotes/tags/r89-trunk remotes/tags/snuploader_name remotes/tags/snuploader_name@29 remotes/tags/snuploader_name@36 remotes/tags/twitter remotes/trunk remotes/twitter-0.1 remotes/twitter-0.1@44 remotes/twitter-0.1@65 remotes/twitter-0.1@66 remotes/vendor }}} 1. mitty@test:~/works/lab (master)$ mv .git/refs/remotes/tags/* .git/refs/tags/ 1. mitty@test:~/works/lab (master)$ rmdir .git/refs/remotes/tags/ 1. mitty@test:~/works/lab (master)$ mv .git/refs/remotes/* .git/refs/heads/ 1. mitty@test:~/works/lab (master)$ rmdir .git/refs/remotes/ 1. vim .git/packed-refs {{{ :%s/refs\/remotes\/tags/refs\/tags/g :%s/refs\/remotes/refs\/heads/g }}} * リポジトリがある程度以上の大きさの場合、必要になる * .git/packed-refs が存在しない場合はskipしてよい模様 * mitty@test:~/works/lab (master)$ git tag -l {{{ r89-trunk snuploader_name snuploader_name@29 snuploader_name@36 twitter }}} * mitty@test:~/works/lab (master)$ git br -a {{{ * master trunk twitter-0.1 twitter-0.1@44 twitter-0.1@65 twitter-0.1@66 vendor }}} * mitty@test:~/works/lab (master)$ git co vendor {{{ Switched to branch 'vendor' }}} * mitty@test:~/works/lab (vendor)$ ls -1F {{{ DrRacket/ GeSHi-1.0.8.9/ lxc/ OCaml/ SnUploader/ TipAndDoc/ trac/ twitter/ ubuntu/ utvpn/ vmware/ }}} = git-http-backend = * [https://www.kernel.org/pub/software/scm/git/docs/git-http-backend.html git-http-backend(1)] * [http://d.hatena.ne.jp/ono51/20120619/p1 nginxでgitリポジトリの公開 - Smart HTTPを試してみた - 逆襲のWebエンジニア] * [http://www.toofishes.net/blog/git-smart-http-transport-nginx/ toofishes.net - Git smart HTTP transport on nginx] * [http://serverfault.com/questions/334127/howto-nginx-git-http-backend-fcgiwrap-debian-squeeze Howto Nginx + git-http-backend + fcgiwrap (Debian Squeeze) - Server Fault] * fastcgi_passは最初の方にあっても良い模様 * {{{fastcgi_param SCRIPT_FILENAME}}}はかならず{{{include fastcgi_params}}}よりも先に記述しないとダメ(以下の様に意図しない場所へchdirされエラーになる) {{{ FastCGI sent in stderr: "Cannot chdir to script directory (/usr/share/nginx/www/git/test.git/info)" }}} * Ubuntu 12.04では、{{{fcgiwrap}}}パッケージを導入すると{{{/var/run/fcgiwrap.socket}}}が自動的に作成される = prompt = * bash * [http://blog.asial.co.jp/845 Gitを使い始めたらやっておきたい便利な設定いろいろ : アシアルブログ] * [http://d.hatena.ne.jp/deeeki/20110402/git_branch_ps1 Gitブランチ名を__git_ps1でbashプロンプトに表示 - 130単位] * [http://d.hatena.ne.jp/notogawa/20120720/1342756620 bashのプロンプトにブランチ名を右寄せ表示する - ぼくのぬまち 出張版] * source:lab/trunk/TipAndDoc/.gitconfig, source:lab/trunk/TipAndDoc/.bashrc = github = * [http://addyosmani.com/blog/backing-up-a-github-account/ Pro-tip: How To Backup All Of Your GitHub Repositories In One Go] * github:joeyh/github-backup * [http://daicham.hatenablog.com/entry/20111005/1317829785 初めてPull Requestをマージしてみた - daicham blog] * [http://akisute.com/2011/02/github-pull-request.html A-Liaison BLOG: github で pull request をされたとき・するときの手順] * [http://d.hatena.ne.jp/hnw/20110528 GitHubへpull requestする際のベストプラクティス - hnwの日記] > ここで大事な点を強調しておきますが、絶対にmasterブランチで作業してはいけません。また、masterブランチからpull requestを送るのもいけません。必ずpull requestのための別ブランチから送るようにしましょう。 * [http://stackoverflow.com/questions/10045517/embedding-images-inside-a-github-wiki-gollum-repository documentation - Embedding images inside a GitHub wiki (gollum) repository? - Stack Overflow] > github:mojombo/gollum-demo/blob/master/Mordor/Eye-Of-Sauron.md = gitweb = * github:kogakure/gitweb-theme * [http://d.hatena.ne.jp/wait-st/20111016/1318755726 gitweb + Nginx を使ってgitリポジトリをWEBで見られるようにする - Wait at a Street corner] * [http://d.hatena.ne.jp/Yudoufu/20110626/1309066814 gitoliteとgitweb on nginx を連携させたメモ - ゆどうふろぐ] * [https://sixohthree.com/1402/running-gitweb-in-fastcgi-mode Running gitweb in FastCGI Mode | 603] * [https://gist.github.com/beheadedmyway/1549832 Gitweb on Centos behind Nginx with init script.] * [http://rouge.eu.org/blog/web/git-web-nginx/ Using git-web with nginx | Jeff's musings] * 以下の様に設定するのがすっきりすると思われる {{{ location ~ /gitweb/(.*) { fastcgi_pass unix:/var/run/fcgiwrap.socket; fastcgi_param SCRIPT_FILENAME /usr/share/gitweb/gitweb.cgi; include fastcgi_params; fastcgi_param PATH_INFO $1; } }}} * {{{/gitweb/(.*)}}}を{{{/gitweb(/.*)}}}とすると、リンクが正常に生成されないので注意