44
41

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.

ローカルで普通に削除しちゃったファイルをGitHubに反映させる

Posted at

GitHubが以下の状態の時・・

foo.txt
bar.txt

ローカルでbar.txtを普通に削除してしまい・・(git rmを使わずに)

foo.txt
bar.txt←削除して物理ファイルは無いけどGit上では管理されてる

GitHub上のbar.txtも削除するにはどうすれば良いか・・

方法1

git add -u
git commit -m 'bar.txt削除をgitに反映'
git push

方法2

git rm bar.txt  ←物理ファイルが無くてもエラーにならない
git commit -m 'bar.txt削除をgitに反映'
git push
44
41
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
44
41

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?