0
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Gitでローカルにあるフォルダやファイルは削除しないでリモートにあるフォルダやファイルを削除する方法

0
Last updated at Posted at 2017-07-26

.gitignoreの条件に当てはまるファイルやフォルダを削除したい場合。

terminal
git rm --cached `git ls-files -i --exclude-from=.gitignore`
git commit -m ".gitignoreの条件に当てはまるリモートのファイルやフォルダを削除"
git push origin master

その他の場合。

terminal
git rm -r --cached myFolder myFile
git commit -m "指定したリモートのファイルやフォルダを削除"
git push origin master

参考

https://stackoverflow.com/questions/6313126/how-to-remove-a-directory-from-git-repository
https://stackoverflow.com/questions/13541615/how-to-remove-files-that-are-listed-in-the-gitignore-but-still-on-the-repositor
http://qiita.com/Potof_/items/c75eba9cfa72819506de

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

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?