
munakata@muna-E420:~/latex$ cat ~/.ssh/config Host MYTHEN HostName mythen.hmuna.com Port 8823 IdentityFile ~/.ssh/muna_E420 User git
munakata@muna-E420:~/beamer/keio2012$ git config --global user.email public_mail@hmuna.com munakata@muna-E420:~/beamer/keio2012$ git config --global user.name "hisao munakata"
munakata@muna-E420:~/beamer/keio2012$ git init Reinitialized existing Git repository in /home/munakata/beamer/keio2012/.git/ munakata@muna-E420:~/beamer/keio2012$ git add *
munakata@muna-E420:~/beamer/keio2012$ git remote add origin ssh://munakata@mythen.hmuna.com:8823/mnt/raid_vol/home/git/repos/XXX
[local] munakata:~/latex/LFS301-JP$ git remote -v github https://github.com/hmunak/LFS301-JP-local.git (fetch) github https://github.com/hmunak/LFS301-JP-local.git (push) hmuna ssh://munakata@mythen.hmuna.com:8823/mnt/raid_vol/home/git/repos/LFS301-JP (fetch) hmuna ssh://munakata@mythen.hmuna.com:8823/mnt/raid_vol/home/git/repos/LFS301-JP (push) origin ssh://munakata@mythen.hmuna.com:8823/mnt/raid_vol/home/git/repos/LFS301-JP (fetch) origin ssh://munakata@mythen.hmuna.com:8823/mnt/raid_vol/home/git/repos/LFS301-JP (push)
− git clone -b ブランチ名 https://リポジトリのアドレス
[local] munakata:~/latex/LFS301-JP$ git branch * main [local] munakata:~/latex/LFS301-JP$ git branch -a * main remotes/github/main remotes/hmuna/main remotes/hmuna/master remotes/origin/HEAD -> origin/master remotes/origin/master
git branch -m main japanese-wip git fetch origin git branch -u origin/japanese-wip japanese-wip git remote set-head origin -a
git branch --set-upstream-to=origin/master master
[local] munakata:~/latex/LFS301-JP$ git status -sb ## japanese-wip2...origin/japanese [ahead 2]
[local] munakata:~/latex/LFS301-JP$ git branch -vv * japanese-wip2 09f7ec1 [origin/japanese: ahead 2] Mint Linux -> Linux Mint, fix missing correction
git push -u origin [ブランチ名]
[local] munakata:~/latex/LFS301$ git branch * (HEAD detached at 313786d) japanese [local] munakata:~/latex/LFS301$ git branch master [local] munakata:~/latex/LFS301$ git checkout master M Makefile Switched to branch 'master' [local] munakata:~/latex/LFS301$ git branch japanese * master
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) に書き換えるとコミットが前のコミットにマージされる
[local] munakata:~/source/perl/nana2tex$ git diff eada 8435 --stat Makefile | 6 ++++-- nana2tex.pl | 78 +++++++++++++++++++++++++++++++----------------------------------------------- 2 files changed, 35 insertions(+), 49 deletions(-)
Your local change would be overwritten by merge. Commit, stash or revert to proceed と言われたら
git stash save -u git stash list git pull git stash pop <------ 自動マージを試みる、コンフリクトしたら手修正 git drop <---- stash したファイルの削除
// 1) リモートの最新を取ってきておいて・・ $ git fetch origin master // 2) ローカルのmasterを、リモート追跡のmasterに強制的に合わせる! $ git reset --hard origin/master
git log --pretty=format:"%h - %an, %ar : %s" ca82a6d - Scott Chacon, 11 months ago : changed the version number 085bb3b - Scott Chacon, 11 months ago : removed unnecessary test code a11bef0 - Scott Chacon, 11 months ago : first commit
| %H | コミットのハッシュ |
| %h | コミットのハッシュ (短縮版) |
| %T | ツリーのハッシュ |
| %t | ツリーのハッシュ (短縮版) |
| %P | 親のハッシュ |
| %p | 親のハッシュ (短縮版) |
| %an | Author の名前 |
| %ae | Author のメールアドレス |
| %ad | Author の日付 (--date= オプションに従った形式) |
| %ar | Author の相対日付 |
| %cn | Committer の名前 |
| %ce | Committer のメールアドレス |
| %cd | Committer の日付 |
| %cr | Committer の相対日付 |
| %s | 件名 |
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
これは以下の2つをまとめて実行したことになる
git rm --cached [ファイル名]
git rm -r --cached .
git checkout -f abc123 hoge.txt
core.quotePath Commands that output paths (e.g. ls-files, diff), will quote "unusual" characters in the pathname by enclosing the pathname in double-quotes and escaping those characters with backslashes in the same way C escapes control characters (e.g. \t for TAB, \n for LF, \\ for backslash) or bytes with values larger than 0x80 (e.g. octal \302\265 for "micro" in UTF-8). If this variable is set to false, bytes higher than 0x80 are not considered "unusual" any more. Double-quotes, backslash and control characters are always escaped regardless of the setting of this variable. A simple space character is not considered "unusual". Many commands can output pathnames completely verbatim using the -z option. The default value is true.
cat (クライアントの公開鍵)>> ~/.ssh/authorized_keys chmod 600 ~/.ssh/authorized_keys
munakata@muna-E420:~/latex$ cat ~/.ssh/config Host MYTHEN HostName mythen.hmuna.com Port 8823 IdentityFile ~/.ssh/muna_E420 (公開鍵) User munakata
$ ssh-agent bash $ ssh-add ~/.ssh/(秘密鍵)
注:gitサーバーの .ssh のディレクトリーのパーミションが 700 でないと、git push 時に git ユーザーのパスワードを聞かれる(が、git アカウントには対話ログインを許可していないので正しいパスワードを入れても push できない。)
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/*