はじめてのGitHub
GitHubにリポジトリを作成してローカルのソースをコミットするまでの履歴を残す。
GitHub作業
https://github.com/
GitHubのアカウントを作成。
※2014年にアカウントは作成済みだった。
javaee7studyリポジトリを作成。
ローカル作業
Eclipseのワークスペースへ移動
GitHubのリポジトリをローカルへ持ってくる。
$ git clone https://github.com/ikhr/javaee7study Cloning into 'javaee7study'... remote: Counting objects: 3, done. remote: Total 3 (delta 0), reused 0 (delta 0), pack-reused 0 Unpacking objects: 100% (3/3), done. $ cd javaee7study/
試しに作ったソースコードをjavaee7studyフォルダへコピーしGitHubへ反映。
$ git status On branch master Your branch is up-to-date with 'origin/master'. Untracked files: (use "git add <file>..." to include in what will be committed) pom.xml src/ nothing added to commit but untracked files present (use "git add" to track) $ git add . $ git status On branch master Your branch is up-to-date with 'origin/master'. Changes to be committed: (use "git reset HEAD <file>..." to unstage) new file: pom.xml new file: src/main/java/com/app/TodoBean.java new file: src/main/java/com/app/flow/FlowCounter.java new file: src/main/java/com/app/flow/FlowCounterDefinition.java new file: src/main/webapp/WEB-INF/web.xml new file: src/main/webapp/flow/firstFlow.xhtml new file: src/main/webapp/flow/flowEntry.xhtml new file: src/main/webapp/flow/secondFlow.xhtml new file: src/main/webapp/flow/thirdFlow.xhtml new file: src/main/webapp/todo.xhtml $ git branch * master $ git branch -a * master remotes/origin/HEAD -> origin/master remotes/origin/master $ git commit -m "お試し初回コミット" [master e4e67a3] お試し初回コミット Committer: PCのユーザ名 <PCのマシン名> Your name and email address were configured automatically based on your username and hostname. Please check that they are accurate. You can suppress this message by setting them explicitly. Run the following command and follow the instructions in your editor to edit your configuration file: git config --global --edit After doing this, you may fix the identity used for this commit with: git commit --amend --reset-author 10 files changed, 326 insertions(+) create mode 100644 pom.xml create mode 100644 src/main/java/com/app/TodoBean.java create mode 100644 src/main/java/com/app/flow/FlowCounter.java create mode 100644 src/main/java/com/app/flow/FlowCounterDefinition.java create mode 100644 src/main/webapp/WEB-INF/web.xml create mode 100644 src/main/webapp/flow/firstFlow.xhtml create mode 100644 src/main/webapp/flow/flowEntry.xhtml create mode 100644 src/main/webapp/flow/secondFlow.xhtml create mode 100644 src/main/webapp/flow/thirdFlow.xhtml create mode 100644 src/main/webapp/todo.xhtml $ git push Counting objects: 21, done. Delta compression using up to 4 threads. Compressing objects: 100% (17/17), done. Writing objects: 100% (21/21), 5.29 KiB | 0 bytes/s, done. Total 21 (delta 2), reused 0 (delta 0) remote: Resolving deltas: 100% (2/2), done. To https://github.com/ikhr/javaee7study 5bf247d..e4e67a3 master -> master
GitHub作業
GitHubでコミットを確認。
コミットユーザがフルネームになっていた。
ローカル作業
コミットユーザ名を変更する。
$ git config --local user.name ikhr $ git config --local user.email gat.d90@gmail.com $ git commit --amend --author="ikhr <gat.d90@gmail.com>" [master 1c6dd5a] お試し初回コミット Date: Sat Dec 2 11:43:08 2017 +0900 10 files changed, 326 insertions(+) create mode 100644 pom.xml create mode 100644 src/main/java/com/app/TodoBean.java create mode 100644 src/main/java/com/app/flow/FlowCounter.java create mode 100644 src/main/java/com/app/flow/FlowCounterDefinition.java create mode 100644 src/main/webapp/WEB-INF/web.xml create mode 100644 src/main/webapp/flow/firstFlow.xhtml create mode 100644 src/main/webapp/flow/flowEntry.xhtml create mode 100644 src/main/webapp/flow/secondFlow.xhtml create mode 100644 src/main/webapp/flow/thirdFlow.xhtml create mode 100644 src/main/webapp/todo.xhtml $ git rebase --continue No rebase in progress? $ git log --pretty=full commit 1c6dd5ad6a1aaefd5c395876196a6a33536ebbc7 Author: ikhr <gat.d90@gmail.com> Commit: ikhr <gat.d90@gmail.com> お試し初回コミット commit 5bf247daddb833b335bcd6140d4e40e679c1353e Author: ikhr <gat.d90@gmail.com> Commit: GitHub <noreply@github.com> Initial commit $ git push --force-with-lease origin master Counting objects: 21, done. Delta compression using up to 4 threads. Compressing objects: 100% (17/17), done. Writing objects: 100% (21/21), 5.26 KiB | 0 bytes/s, done. Total 21 (delta 2), reused 0 (delta 0) remote: Resolving deltas: 100% (2/2), done. To https://github.com/ikhr/javaee7study + e4e67a3...1c6dd5a master -> master (forced update)
GitHub作業
GitHubでコミットを確認。 コミットユーザが ikhr になった。
2017.12.6 追記
ユーザ名とメールアドレスをglobal
で登録しなおした。
$ git config --global user.name ikhr $ git config --global user.email gat.d90@gmail.com $ git config --list credential.helper=osxkeychain user.name=ikhr user.email=gat.d90@gmail.com
2017.12.10 追記
git
とbrew
は奥さんがインストールを済ませていた雰囲気。