0
1

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 pushで重たいファイルをgithubに上げた時の対処

Last updated at Posted at 2024-06-28

githubに重たいファイルを挙げてしまって、git pushの途中で、どうしたらいいか分からなくなった時の対処方法です。

結論から言うと以下二つのコマンドを実行して、.gitignoreに重たくてアップできなかったファイルを記載して、ignoreする設定にすれば大丈夫です。

git reset --soft HEAD^  # commitの取り消し
git reset --mixed HEAD  # addの取り消し

このページを見ている皆さんは、おそらくこの記事以外のサイトなども参考に色々コマンドを調べると思います。
ただコマンドの中には、編集したファイルが編集前に戻す(編集箇所が消えた)ことがあったので、一度編集したファイルをダウンロードしたり、バックアップを取ることをお勧めします!

これで、.gitignoreを編集し重たいファイルを無視するようにすれば再度git pushすれば完了!

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

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?