github使い方学習

参考:

mini:~ hoge$ mkdir tmp
mini:~ hoge$ cd tmp
mini:~/tmp hoge$ git clone https://github.com/riocampos/Spoon-Knife.git
Cloning into 'Spoon-Knife'...
Username for 'https://github.com': riocampos	
Password for 'https://riocampos@github.com': 
fatal: https://github.com/riocampos/Spoon-Knife.git/info/refs not found: did you run git update-server-info on the server?

あ、先にWeb画面でforkしなきゃいけなかったのか(当たり前)。

https://github-images.s3.amazonaws.com/help/Bootcamp-Fork.png
Fork a repo - User Documentation

これで自分の所にforkできたみたい。

mini:~/tmp hoge$ git clone https://github.com/riocampos/Spoon-Knife.git
Cloning into 'Spoon-Knife'...
remote: Counting objects: 24, done.
remote: Compressing objects: 100% (19/19), done.
remote: Total 24 (delta 7), reused 17 (delta 3)
Unpacking objects: 100% (24/24), done.
mini:~/tmp hoge$ cd Spoon-Knife/
mini:~/tmp/Spoon-Knife hoge$ git remote add upstream https://github.com/octocat/Spoon-Knife.git
mini:~/tmp/Spoon-Knife hoge$ git fetch upstream
From https://github.com/octocat/Spoon-Knife
 * [new branch]      master     -> upstream/master
mini:~/tmp/Spoon-Knife hoge$ git push origin master
Username for 'https://github.com': riocampos
Password for 'https://riocampos@github.com': 
Everything up-to-date
mini:~/tmp/Spoon-Knife hoge$ git fetch upstream
mini:~/tmp/Spoon-Knife hoge$ git merge upstream/master
Already up-to-date.
mini:~/tmp/Spoon-Knife hoge$ git pull upstream
You asked to pull from the remote 'upstream', but did not specify
a branch. Because this is not the default configured remote
for your current branch, you must specify a branch on the command line.
mini:~/tmp/Spoon-Knife hoge$ git branch mybranch
mini:~/tmp/Spoon-Knife hoge$ git checkout mybranch
Switched to branch 'mybranch'
mini:~/tmp/Spoon-Knife hoge$ git checkout -b mybranch
fatal: A branch named 'mybranch' already exists.
mini:~/tmp/Spoon-Knife hoge$ git checkout master
Switched to branch 'master'
mini:~/tmp/Spoon-Knife hoge$ git checkout mybranch
Switched to branch 'mybranch'
mini:~/tmp/Spoon-Knife hoge$ nano README 
mini:~/tmp/Spoon-Knife hoge$ git commit -a -m 'testtest'
[mybranch cef34ee] testtest
 1 file changed, 3 insertions(+), 1 deletion(-)
mini:~/tmp/Spoon-Knife hoge$ git checkout master
Switched to branch 'master'
mini:~/tmp/Spoon-Knife hoge$ git merge mybranch
Updating bdd3996..cef34ee
Fast-forward
 README |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
mini:~/tmp/Spoon-Knife hoge$ git branch -d mybranch
Deleted branch mybranch (was cef34ee).
mini:~/tmp/Spoon-Knife hoge$ git status
# On branch master
# Your branch is ahead of 'origin/master' by 1 commit.
#
nothing to commit (working directory clean)
mini:~/tmp/Spoon-Knife hoge$ git push origin master
Username for 'https://github.com': riocampos	
Password for 'https://riocampos@github.com': 
Counting objects: 5, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (2/2), done.
Writing objects: 100% (3/3), 345 bytes, done.
Total 3 (delta 0), reused 0 (delta 0)
To https://github.com/riocampos/Spoon-Knife.git
   bdd3996..cef34ee  master -> master

(また理解してからごにょごにょ書くことにする)