2013-05-23 21:46:11 +0000 2013-05-23 21:46:11 +0000
17
17
Advertisement

GitHub - 私のコンピュータ内のgitHubのローカルファイルを完全に台無しにしてしまいました。

Advertisement

間違ったフォルダにレポを作成してしまいました。つまり、OS の User フォルダの中にある pics やビデオからドキュメントまで、すべてのユーザーフォルダが存在しているということです。そのため、知らないうちにすべてを gitHub にプッシュしてしまったのですが、今ではレポを作成することができなくなってしまいました。そして、レポの中にレポを作成していることを暗示してしまいます。ですから、ターミナルに行って git status を実行すると、次のように表示されます。

# On branch master
# Your branch and 'origin/master' have diverged,
# and have 2 and 4 different commits each, respectively.
#
# 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: Documents/m3/m3---Best-Game-Ever
# deleted: Documents/of_v0072_osx_release/apps/myApps/CCLab_2/cclab_sketch_1/src/Boxes.cpp
# deleted: Documents/of_v0072_osx_release/apps/myApps/CCLab_2/cclab_sketch_1/src/Boxes.h
# deleted: Documents/of_v0072_osx_release/apps/myApps/ball_bouncing/Ball.cpp
# deleted: Documents/of_v0072_osx_release/apps/myApps/ball_bouncing/Ball.h
# deleted: Documents/of_v0072_osx_release/apps/myApps/bouncing_ball_classes/src/ball.cpp
# deleted: Documents/of_v0072_osx_release/apps/myApps/bouncing_ball_classes/src/ball.h
# deleted: Documents/of_v0072_osx_release/apps/myApps/ms_final/src/backGround.cpp
# deleted: Documents/of_v0072_osx_release/apps/myApps/ms_final/src/backGround.h
# deleted: Documents/of_v0072_osx_release/apps/myApps/ms_final/src/backGround2.cpp
# deleted: Documents/of_v0072_osx_release/apps/myApps/ms_final/src/backGround2.h
# deleted: Documents/of_v0072_osx_release/apps/myApps/mySketch/src/backGround.cpp
# deleted: Documents/of_v0072_osx_release/apps/myApps/mySketch/src/backGround.h
# deleted: Documents/of_v0072_osx_release/apps/myApps/mySketch/src/backGround2.cpp
# deleted: Documents/of_v0072_osx_release/apps/myApps/mySketch/src/backGround2.h
# deleted: README.md
#
# Untracked files:
# (use "git add <file>..." to include in what will be committed)
#
# .Trash/
# .bash_history
# .dropbox/
# .openmdao/
# .ssh/
# Documents/2nd_semester/
# Documents/Arduino/
# Documents/OpenMDAO/
# Documents/Personal/
# Documents/T.A/
# Documents/gitHub/
# Documents/mySite/
# Documents/openFrameworks/
# Documents/resources/
# Documents/webcam-pulse-detector-master/
# Dropbox/
# Library/
# Music/
no changes added to commit (use "git add" and/or "git commit -a")

言うまでもなく、何もプルできません。すべてが最新の状態になっていると表示されます。ある時点で、これらのフォルダをファイルなしで gitHub にアップロードするレポを持っていたのですが、それを削除してしまいました。

何か提案はありますか?

Advertisement
Advertisement

回答 (2)

28
28
28
2013-05-23 22:09:13 +0000

まず最初にやること:

  1. ユーザーフォルダをアップロードしたGithubリモートリポジトリを削除 (これを公開しないようにします)
  2. ユーザーフォルダ内の ローカルリポジトリ を削除します。

これで、Documents以下のローカルリポジトリが再び動作を開始すれば、**あなたの作業は完了です。そうでなければ、それらを一つずつ削除してクローンしてください(もちろん、これはコミットされていない変更と以前にプッシュしていないコミットの両方を破棄することになるので注意してください)。

cd ~/Documents/gitHub/
 # example, and again, be careful, it will erase your entire folder
 rm -rf repositoryA
 git clone git://github.com/myUser/repositoryA.git
 rm -rf repositoryB
 git clone git://github.com/myUser/repositoryB.git 
 # And so on
1
1
1
2019-03-31 16:41:23 +0000

mac osの.gitフォルダを再帰的に削除するには、.gitフォルダを含むプロジェクトのルートフォルダに移動し、

find . | grep .git | xargs rm -rf

を使用します。

0x1&

を使用して、その内容とそれ自身を削除してください。

Advertisement

関連する質問

19
4
12
5
1
Advertisement