Skip to content

Instantly share code, notes, and snippets.

@ledsun
Last active October 6, 2015 07:28
Show Gist options
  • Save ledsun/2958132 to your computer and use it in GitHub Desktop.
Save ledsun/2958132 to your computer and use it in GitHub Desktop.
githubを使うときのメモ

githubを使うときのメモ

新しいリポジトリを作ったり既存のリポジトリを別のPCに持ってくるときに毎回苦労するのでメモを作ります。

既存のリポジトリを持ってくる

github上に存在するリポジトリを別PCで編集する環境を作ります。

git clone [email protected]:ledsun/SandBox.git

実行したディレクトリにSandBoxというディレクトリができるます。SandBoxというディレクトリを先に作らない点に注意。

新規のリポジトリを作る

ガイド通りにhttpsスキーマ使うとユーザ名を聞かれてハマるのでurlを変えること

git remote add origin [email protected]:ledsun/SandBox.git

Why is Github asking for username/password when following the instructions on screen and pushing a new repo?

branchを作る

既存のブランチを確認

git branch -a

###ブランチを作成

git checkout -b work master

###リモートにpush

git push origin work

###ブランチを切り替え

git checkout master

特定のブランチを取得

git clone [email protected]:ledsun/SandBox.git
git fetch && git checkout branch_name
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment