ローカルで実行したファイル削除を,GitHubに反映させる
ローカルでファイルを削除した時に
リモートに既にpushしてしまっていると,
ブラウザから見た時に
削除したはずのファイルが消えていません_(┐「ε:)_
[core@localhost ~]$ git status # On branch master # Changes not staged for commit: # (use "git add/rm <file>..." to update what will be committed) # (use "git checkout -- <file>..." to discard changes in working directory) # # deleted: Downloads/test/test.txt # deleted: hoge/memo.txt # no changes added to commit (use "git add" and/or "git commit -a")
git statusでみてみると,残っていました.
これはgit rm 対象ファイル名で削除することができますが
たくさんあるときは次のようにして一気に消しちゃいましょう.
[core@localhost ~]$ git add -u [core@localhost ~]$ git status # On branch master # Changes to be committed: # (use "git reset HEAD <file>..." to unstage) # # deleted: Downloads/test/test.txt # deleted: hoge/memo.txt # [core@localhost ~]$
もしgitの設定で文字に色をつけていた場合,
今青色に見えている部分は赤から緑に変わったかと思います.
[core@localhost ~]$ git commit -m "cleanup" [master e736ac7] cleanup 16 files changed, 541 deletions(-) delete mode 100644 Downloads/test/test.txt delete mode 100644 hoge/memo.txt [core@localhost ~]$
あとはpushをし,もう一度git statusで確認をして
以下のように表示されたら,ローカルに反映されていると思います.
[core@localhost ~]$ git status
# On branch master
nothing to commit, working directory clean
[core@localhost ~]$