Github での今のやり方の覚書 (Clone しないで作業)

Clone しないで作業

あらかじめ、Local にリモートのリポジトリと同名のディレクトリを作成しておく。
そこには、すでに、hello.goが作成済み。

すでに、

$ git config --global user.email xxx@xxxx.xx
$ git config --global user.name "USERNAME"

はやってある。

$ mkdir gohello
$ cd gohello
$ git init

Githubで、リポジトリを作成。URLをコピーする。

$ git remote add origin  https://github.com/guutara/gohello.git

$ git fetch origin master
remote: Counting objects: 3, done.
remote: Compressing objects: 100% (2/2), done.
remote: Total 3 (delta 0), reused 0 (delta 0), pack-reused 0
Unpacking objects: 100% (3/3), done.
From https://github.com/guutara/gohello
 * branch            master     -> FETCH_HEAD
 * [new branch]      master     -> origin/master

$ git pull origin master
From https://github.com/guutara/gohello
 * branch            master     -> FETCH_HEAD

$ git branch
* master

$ git add hello.go

$ git status
On branch master
Changes to be committed:
  (use "git reset HEAD <file>..." to unstage)

    new file:   hello.go

$ git commit -a -m "First commit"
[master c62e771] First commit
 1 file changed, 7 insertions(+)
 create mode 100644 hello.go

$ git push -u origin master
Counting objects: 3, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (3/3), done.
Writing objects: 100% (3/3), 350 bytes | 0 bytes/s, done.
Total 3 (delta 0), reused 0 (delta 0)
To https://github.com/guutara/gohello.git
   a72be4a..c62e771  master -> master
Branch master set up to track remote branch master from origin.

2かいめ以降の修正

hello.go 修正後。

$ git status
On branch master
Your branch is up-to-date with 'origin/master'.
Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git checkout -- <file>..." to discard changes in working directory)

    modified:   hello.go

  no changes added to commit (use "git add" and/or "git commit -a")

$ git commit -a -m "add line "
[master 934a631] add line
 1 file changed, 2 insertions(+), 1 deletion(-)

$ git push origin master
Counting objects: 3, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (3/3), done.
Writing objects: 100% (3/3), 350 bytes | 0 bytes/s, done.
Total 3 (delta 0), reused 0 (delta 0)
To https://github.com/guutara/gohello.git
  c62e771..934a631  master -> master