基本†

↑

前提†

↑

設定†

↑

運用†

↑

ローカルリポジトリの作成†

↑

リモートリポジトリの作成†

↑

ローカルの内容をリモートに反映†

↑

ローカルに git を導入†

↑

ローカルとリモートの repo の関係付け (一回だけ)†

munakata@muna-E420:~/beamer/keio2012$ git remote add origin ssh://munakata@mythen.hmuna.com:8823/mnt/raid_vol/home/git/repos/XXX
↑

ローカルブランチ (=master) のトラッキング先を明示的に指定†

git branch --set-upstream-to=origin/master master
↑

インデックス、 ワーキングツリー、 HEAD の関係の変化†

↑

git add -p†

↑

git commit†

↑

git commit <path>†

↑

git rebase -i で過去数回分のコミットをまとめる†

pick 29e1651 evaluate model updated, still in struggle
pick 35d15a4 temporaly save (no major change)
pick 356c295 removed unused view (preffered flag)
pick b81062d removed build-in command (vman_entry.py)

# Rebase ca395bd..b81062d onto ca395bd (4 commands)
#
# Commands:
# p, pick = use commit
# r, reword = use commit, but edit the commit message
# e, edit = use commit, but stop for amending
# s, squash = use commit, but meld into previous commit
# f, fixup = like "squash", but discard this commit's log message
# x, exec = run command (the rest of the line) using shell
# d, drop = remove commit
#

pick を s (squash) に書き換えるとコミットが前のコミットにマージされる

↑

git diff と git diff HEAD と git diff --cached の違い†

↑

git reset†

↑

ローカルの master を、強制的にリモートの master に合わせる†

// 1) リモートの最新を取ってきておいて・・
$ git fetch origin master

// 2) ローカルのmasterを、リモート追跡のmasterに強制的に合わせる!
$ git reset --hard origin/master
↑

git commit --amend : 直前のコミットのやり直し†

↑

git reset <path>†

↑

git revert†

↑

git fetch†

↑

git log†

↑

git push ローカル上の変更をリモートに反映†

munakata@muna-E420:~/beamer/keio2012$ git push e420 master
munakata@mythen.hmuna.com's password: 
Counting objects: 5, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (3/3), done.
Writing objects: 100% (3/3), 337 bytes, done.
Total 3 (delta 2), reused 0 (delta 0)
To ssh://munakata@mythen.hmuna.com:8823/mnt/raid_vol/home/munakata/repos/keio2012
   462fe87..7a936a0  master -> master
↑

既にあるブランチへの切り替え†

↑

git ブランチを作成して、そのブランチに移動†

これは以下の2つをまとめて実行したことになる

↑

git ブランチをプッシュ†

↑

git ブランチの削除†

↑

git の管理対象から外す†

↑

git の管理対象から外す2(.gitignore に追加登録する場合には必須)†

↑

git gc†

↑

過去のリビジョンからファイルを復元 (abc123リビジョンにあるhoge.txtを持ってきたいとする)†

git checkout -f abc123 hoge.txt
↑

git tag†

↑

tag を削除 (付け直す)†

↑

git diff†

↑

git send-email†

↑

git credential helperを使って HTTP越しで 認証がかかっているリポジトリにアクセスする†

↑

SSH 接続でパスワードなしにするには公開鍵をサーバーに登録する†

注:gitサーバーの .ssh のディレクトリーのパーミションが 700 でないと、git push 時に git ユーザーのパスワードを聞かれる(が、git アカウントには対話ログインを許可していないので正しいパスワードを入れても push できない。)

↑

git 環境変数の設定†

munakata@mythen:~/My_presentations/als2013JP$ git config -l
color.ui=auto
user.name=hisao munakata
user.email=public_mail@hmuna.com
core.quotepath=false
core.repositoryformatversion=0
core.filemode=true
core.bare=false
core.logallrefupdates=true
remote.origin.fetch=+refs/heads/*:refs/remotes/origin/*
remote.origin.url=ssh://munakata@mythen.hmuna.com:8823/mnt/raid_vol/home/munakata/repos/als2013JP
branch.master.remote=origin
branch.master.merge=refs/heads/master
remote.mythen.url=ssh://munakata@mythen.hmuna.com:8823/mnt/raid_vol/home/munakata/repos/als2013JP
remote.mythen.fetch=+refs/heads/*:refs/remotes/mythen/*
↑

git 公式サイトマニュアル(日本語)†

↑

逆引き git†


トップ   新規 一覧 検索 最終更新   ヘルプ   最終更新のRSS