せかいや

いまいるここを、おもしろく http://sekai-in-the-box.appspot.com/

【Git】【GitHub】はまったところメモ

commit はステージングするだけ

ステージングするだけなので、リモート情報は要らない(そりゃそうだ)

C:\repositories\study_git [saitousan +1 ~0 -0]> git commit
[saitousan 3169420] create b.txt
 1 file changed, 1 insertion(+)
 create mode 100644 b.txt
 


 

リモートリポジトリの指定の仕方

ブランチ名が以下のように表示された場合、
リモートリポジトリ名は「remotes/origin/saitousan」などとなる。

C:\repositories\study_git [saitousan +1 ~0 -0]> git branch -a
  master
* saitousan
  remotes/origin/HEAD -> origin/master
  remotes/origin/addtashizan
  remotes/origin/master
  remotes/origin/saitousan


※ぐぐっても「origin/…」の表記方法しか出なかったので。
この状態で「origin/…」と指定してもエラーになる。



git diff のリポジトリ指定方法

前述した、ブランチ名を指定する

C:\repositories\study_git [saitousan +1 ~0 -0]> git diff remotes/origin/saitousan


 

git push 時は 「remotes」がいらない

origin は.git/config ファイルで名前解決しているから。

C:\repositories\study_git [saitousan]> git push origin saitousan:saitousan
Counting objects: 4, done.
Delta compression using up to 2 threads.