0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

Git Tips

Last updated at Posted at 2025-01-11

プッシュ後のコミットログ変更

N個前のコミットメッセージを変更

  1. 以下を実行し、変更したいメッセージのpickをeditに変更し保存
    $ git rebase -i HEAD^N
    
  2. 以下を実行し、メッセージを修正し保存
    $ git commit --amend
    
  3. 以下を実行し、メッセージ修正を確定
    $ git commit --continue
    

※以下手順2,3をpick→editに変更した回数繰り返す

リモートリポジトリへの反映

git push origin main --force-with-lease

チェックアウトしているコミットのID確認

$ git show -s --format=%H
or
% git log -n 1 --format=%H

オプション

git clone --depth=1

最新のコミットだけクローン。履歴がたくさんあり、手元に落としてきたくないときに有効。

参考

0
0
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
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?