雑記

日記とかメモとか

日記

体調

枕が体に合わないのか寝ても頭がめちゃくちゃ痛い。 首から頭にかけて。

食事

セブンの弁当2つ。

ゲーム

今更だけどスプラ2やってた。 TPS苦手だけど楽しい。 まだレベル20なのではやく30にせねば! ガチマはヤグラがB+からBまで落ちた。 仲間が私にジャンプしてきてキルされるシチュエーションが凄く多かった。 私も下手なのでカバー出来ず。。。申し訳なかったなあ。

コミットを1つにまとめ、タイムスタンプを現在時刻にする。

コミットを1つにまとめる

$ git log --pretty=fuller
commit 3bd88c199506179b48c9e2be3841be931b342ba4 (HEAD -> branchA)
Author:     HogeHoge <HogeHoge@HogeHoge.com>
AuthorDate: Sun Jul 29 17:29:48 2018 +0900
Commit:     HogeHoge <HogeHoge@HogeHoge.com>
CommitDate: Sun Jul 29 17:29:48 2018 +0900

    add commit3.txt

commit 2c6b04c465cc49b80830fa1b7c51abf3dbd9b0fd
Author:     HogeHoge <HogeHoge@HogeHoge.com>
AuthorDate: Sun Jul 29 17:29:35 2018 +0900
Commit:     HogeHoge <HogeHoge@HogeHoge.com>
CommitDate: Sun Jul 29 17:29:35 2018 +0900

    add commit2.txt

commit 60214c31c8ad7ab72d70d19bf676e9e6e9a442b6
Author:     HogeHoge <HogeHoge@HogeHoge.com>
AuthorDate: Sun Jul 29 17:29:21 2018 +0900
Commit:     HogeHoge <HogeHoge@HogeHoge.com>
CommitDate: Sun Jul 29 17:29:21 2018 +0900

    add commit1.txt

commit 3cb709bba00fcfddc07aa9427de8c399de88c1ea (origin/master, master)
Author:     HogeHoge <HogeHoge@HogeHoge.com>
AuthorDate: Sun Jul 29 01:05:38 2018 +0900
Commit:     HogeHoge <HogeHoge@HogeHoge.com>
CommitDate: Sun Jul 29 01:05:38 2018 +0900

    remove text

上3つのコミットを一つにまとめる。

$ git rebase -i HEAD~3

HEADから最新3つに対してrebaseすると以下の画面になる。

pick 60214c3 add commit1.txt
pick 2c6b04c add commit2.txt
pick 3bd88c1 add commit3.txt

# Rebase 3cb709b..3bd88c1 onto 3cb709b (3 commands)
#
# Commands:
# p, pick <commit> = use commit
# r, reword <commit> = use commit, but edit the commit message
# e, edit <commit> = use commit, but stop for amending
# s, squash <commit> = use commit, but meld into previous commit
# f, fixup <commit> = like "squash", but discard this commit's log message
# x, exec <command> = run command (the rest of the line) using shell
# d, drop <commit> = remove commit
# l, label <label> = label current HEAD with a name
# t, reset <label> = reset HEAD to a label
# m, merge [-C <commit> | -c <commit>] <label> [# <oneline>]
# .       create a merge commit using the original merge commit's
# .       message (or the oneline, if no original merge commit was
# .       specified). Use -c <commit> to reword the commit message.
#
# These lines can be re-ordered; they are executed from top to bottom.
#
# If you remove a line here THAT COMMIT WILL BE LOST.
#
#       However, if you remove everything, the rebase will be aborted.
#
#
# Note that empty commits are commented out

挿入モードでテキストを少しいじる。

pick 60214c3 add commit1.txt
squash 2c6b04c add commit2.txt
squash 3bd88c1 add commit3.txt

# Rebase 3cb709b..3bd88c1 onto 3cb709b (3 commands)
#
# Commands:

2c6b04cと3bd88c1のpickをsquashし、テキストを保存すると...

# This is a combination of 3 commits.
# This is the 1st commit message:

add commit1.txt

# This is the commit message #1:

add commit2.txt

# This is the commit message #2:

add commit3.txt

# Please enter the commit message for your changes. Lines starting
# with '#' will be ignored, and an empty message aborts the commit.
#
# Date:      Sun Jul 29 17:29:21 2018 +0900
#
# interactive rebase in progress; onto 3cb709b
# Last commands done (3 commands done):
#    squash 2c6b04c add commit2.txt
#    squash 3bd88c1 add commit3.txt
# No commands remaining.
# You are currently rebasing branch 'branchA' on '3cb709b'.
#
# Changes to be committed:
#       new file:   commit1.txt
#       new file:   commit2.txt
#       new file:   commit3.txt

こんな画面が表示されるので、適当にコミットメッセージを書く。

combine 60214c3 2c6b04c 3bd88c1.

# Please enter the commit message for your changes. Lines starting
# with '#' will be ignored, and an empty message aborts the commit.
#
# Date:      Sun Jul 29 17:29:21 2018 +0900
#
# interactive rebase in progress; onto 3cb709b
# Last commands done (3 commands done):

これで保存すると

$ git rebase -i HEAD~3
[detached HEAD a3f47e2] combine 60214c3 2c6b04c 3bd88c1.
 Date: Sun Jul 29 17:29:21 2018 +0900
 3 files changed, 0 insertions(+), 0 deletions(-)
 create mode 100644 commit1.txt
 create mode 100644 commit2.txt
 create mode 100644 commit3.txt
Successfully rebased and updated refs/heads/branchA.

こんな感じでrebase終了してupdateされる。

この時点でのログ

$ git log --pretty=fuller
commit a3f47e27d52954915f63497d4b112054da98f241 (HEAD -> branchA)
Author:     HogeHoge <HogeHoge@HogeHoge.com>
AuthorDate: Sun Jul 29 17:29:21 2018 +0900
Commit:     HogeHoge <HogeHoge@HogeHoge.com>
CommitDate: Sun Jul 29 17:34:18 2018 +0900

    combine 60214c3 2c6b04c 3bd88c1.

commit 3cb709bba00fcfddc07aa9427de8c399de88c1ea (origin/master, master)
Author:     HogeHoge <HogeHoge@HogeHoge.com>
AuthorDate: Sun Jul 29 01:05:38 2018 +0900
Commit:     HogeHoge <HogeHoge@HogeHoge.com>
CommitDate: Sun Jul 29 01:05:38 2018 +0900

    remove text

本来なら 3cb709bとa3f47e2の間に

3bd88c1 2c6b04c 60214c3

の三つがあるはずだけど、a3f47e2にまとめたので消えている。

コミットタイムスタンプを現在時刻に変更

この時点で最後にコミットしたものが以下

$ git log --pretty=fuller
commit a3f47e27d52954915f63497d4b112054da98f241 (HEAD -> branchA)
Author:     HogeHoge <HogeHoge@HogeHoge.com>
AuthorDate: Sun Jul 29 17:29:21 2018 +0900
Commit:     HogeHoge <HogeHoge@HogeHoge.com>
CommitDate: Sun Jul 29 17:34:18 2018 +0900

    combine 60214c3 2c6b04c 3bd88c1.

こいつのCommitDateとAuthorDateを現在時刻にする。

$ git rebase HEAD~1 --ignore-date
Current branch branchA is up to date, rebase forced.
First, rewinding head to replay your work on top of it...
Applying: combine 60214c3 2c6b04c 3bd88c1.
$ git rebase HEAD~1 --committer-date-is-author-date
Current branch branchA is up to date, rebase forced.
First, rewinding head to replay your work on top of it...
Applying: combine 60214c3 2c6b04c 3bd88c1.

ログを確認

$ git log --pretty=fuller
commit 50a2d8037f489e55074d46030bd742b0c9cdcbaa (HEAD -> branchA)
Author:     HogeHoge <HogeHoge@HogeHoge.com>
AuthorDate: Sun Jul 29 18:00:27 2018 +0900
Commit:     HogeHoge <HogeHoge@HogeHoge.com>
CommitDate: Sun Jul 29 18:00:27 2018 +0900

新しいコミットなのでhash変わってるが、AuthoDateとCommitDateは現在時刻で合致した。

$ git log origin/branchA --pretty=fuller
commit 50a2d8037f489e55074d46030bd742b0c9cdcbaa (HEAD -> branchA, origin/branchA)
Author:     HogeHoge <HogeHoge@HogeHoge.com>
AuthorDate: Sun Jul 29 18:00:27 2018 +0900
Commit:     HogeHoge <HogeHoge@HogeHoge.com>
CommitDate: Sun Jul 29 18:00:27 2018 +0900

    combine 60214c3 2c6b04c 3bd88c1.

push後のログもきちんと反映されてるー。

おわり。

Git for Windowsセットアップ

会社ではMacだけど家のWindowsでgitを使う事になったのでメモしておきます。
最近なんでもメモしとかないと忘れるんだよなー。

1:Git for Windows インストール
https://git-scm.com/download/win

「64-bit Git For Windows Setup.」を選択してインストーラをDL。
インストーラはライセンス確認は「Next」インストール先は適当に選択して「Next」
「Select Components」はとりあえずデフォルトで「Next」
f:id:GamerDog:20180728193606p:plain
デフォの項目はこれ。

「Select Start Menu Folder」は「Git」で「Next」
「Choosing the default editor used by Git」はVim使いたいのでそのままで「Next」
「Adjusting your PATH environment」は「Use Git from Git Bash only」で「Next」
「Choosing HTTPS transport backend」は「Use the Open SSL library」で「Next」
「Configuring the line ending conversions」は「Checkout Windows-style~」で「Next」
「Configuring the terminal emulator to use with Git Bash」は「MinTTY」で「Next」
「COnfiguring extra options」はデフォルトで「Next」
f:id:GamerDog:20180728194549p:plain

これでインストールはできた。

git bash開いてgitと打ち込んだらきちんとヘルプ表示されたのでインストールは成功。
(まぁbash開けてる時点でか)

次はコンフィグ設定

$ git config --global user.name "KondouSatoshi"
$ git config --global user.email "kondou.satoshi@email.com"


再起動して設定が正しく反映されているかを確認する

$ git config -l


ひとまずこんな感じでおわりかしらー。