LoginSignup
0
1

More than 3 years have passed since last update.

【Git】間違えてpushしてしまったファイルをリモートから削除する方法

Posted at

前置き

Git初心者がいかに単純に,間違えてpushしたファイルをリモートから消すかの手順をメモしただけです.もっと良い方法があるのかもしれませんが,とにかく消せれば良いという人向け.
このサイトを参考にさせてもらいました.

手順

流れは以下のようになってます.

  1. Gitの管理対象ファイルから消す
  2. 削除したファイルをadd
  3. commit
  4. push

実行

$ git rm test.txt
$ git add -u
$ git commit -m "deleted test.txt"
$ git push origin master

ここで,git add -uは「前ステージと比較して変更点があった部分のみadd」を意味する.

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