Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

This article is a Private article. Only a writer and users who know the URL can access it.
Please change open range to public in publish setting if you want to share this article with other users.

Git amend

Posted at

amend

直前のコミットを修正する。2個前等はrebaseが必要
リモートプッシュ済みの場合は強制プッシュgit push -fが必要なので非推奨

コミット日時を現在日時にする

vimなどでメッセージ保存時でなく、コマンド実行時の日時になります
コマンド実行→vim開いて1分待つ→:wqは無意味ということ

git commit --amend --reset-author

直前のコミットに変更を追加

適宜ステージングしamendする。
コミットメッセージを変えなくていいなら--no-editオプション。

git commit --amend --no-edit

コミットメッセージも変えたい時

ただのamend。

# vimで編集
git commit --amend

# ワンライナーで済むなら
git commit --amend -m "new text"
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?