나는 일부 파일이 bitbucket 저장소에서 삭제될 것이라고 생각하여 git rm을 실행하고 해당 파일도 커밋한 후 해당 파일이 bitbucket 저장소에서 사라졌는지 확인했지만 내 컴퓨터에서도 삭제되었습니다.
이것은 내가 사용하는 명령입니다:
$ git rm -r -f src
rm 'src/main/java/Controller.java'
rm 'src/main/java/DTO.java'
rm 'src/main/java/Scheduler.java'
rm 'src/main/java/Server.java'
rm 'src/main/java/SimulationManager.java'
rm 'src/main/java/SimulatorFrame.java'
rm 'src/main/java/Task.java'
$ git rm -f -r target
rm 'target/classes/Controller$1.class'
rm 'target/classes/Controller$startSimulationListener.class'
rm 'target/classes/Controller.class'
rm 'target/classes/DTO.class'
rm 'target/classes/Scheduler.class'
rm 'target/classes/Server.class'
rm 'target/classes/SimulationManager.class'
rm 'target/classes/SimulatorFrame.class'
rm 'target/classes/Task.class'
$ git rm -f pom.xml
rm 'pom.xml'
$ git rm -f pt2019_30222_tomoiaga_andreistefan_assignment_2.iml
fatal: pathspec 'pt2019_30222_tomoiaga_andreistefan_assignment_2.iml' did not match any files
$ git commit -m "delete commit"
[master a6c5d68] delete commit
22 files changed, 1352 deletions(-)
delete mode 100644 .idea/.name
delete mode 100644 .idea/compiler.xml
delete mode 100644 .idea/misc.xml
delete mode 100644 .idea/vcs.xml
delete mode 100644 .idea/workspace.xml
delete mode 100644 pom.xml
delete mode 100644 src/main/java/Controller.java
delete mode 100644 src/main/java/DTO.java
delete mode 100644 src/main/java/Scheduler.java
delete mode 100644 src/main/java/Server.java
delete mode 100644 src/main/java/SimulationManager.java
delete mode 100644 src/main/java/SimulatorFrame.java
delete mode 100644 src/main/java/Task.java
delete mode 100644 target/classes/Controller$1.class
delete mode 100644 target/classes/Controller$startSimulationListener.class
delete mode 100644 target/classes/Controller.class
delete mode 100644 target/classes/DTO.class
delete mode 100644 target/classes/Scheduler.class
delete mode 100644 target/classes/Server.class
delete mode 100644 target/classes/SimulationManager.class
delete mode 100644 target/classes/SimulatorFrame.class
delete mode 100644 target/classes/Task.class
$ git push origin master
Enumerating objects: 3, done.
Counting objects: 100% (3/3), done.
Delta compression using up to 8 threads
Compressing objects: 100% (2/2), done.
Writing objects: 100% (2/2), 227 bytes | 227.00 KiB/s, done.
Total 2 (delta 1), reused 0 (delta 0)
To https://bitbucket.org/andreistefantomoiaga/pt2019_30222_tomoiaga_andreistefan_assignment_2.git
5ca3e67..a6c5d68 master -> master
$ git rm -f pt2019_30222_tomoiaga_andreistefan_assignment_2.iml
rm 'pt2019_30222_tomoiaga_andreistefan_assignment_2.iml'
$ git commit -m "delete commit"
[master 16ca832] delete commit
1 file changed, 2 deletions(-)
delete mode 100644 pt2019_30222_tomoiaga_andreistefan_assignment_2.iml
$ git rm -f pt2019_30222_tomoiaga_andreistefan_assignment_2.iml
fatal: pathspec 'pt2019_30222_tomoiaga_andreistefan_assignment_2.iml' did not match any files
$ git push origin master
Enumerating objects: 3, done.
Counting objects: 100% (3/3), done.
Delta compression using up to 8 threads
Compressing objects: 100% (1/1), done.
Writing objects: 100% (2/2), 238 bytes | 238.00 KiB/s, done.
Total 2 (delta 0), reused 0 (delta 0)
To https://bitbucket.org/andreistefantomoiaga/pt2019_30222_tomoiaga_andreistefan_assignment_2.git
a6c5d68..16ca832 master -> master
$ git reset HEAD \*
Unstaged changes after reset:
M Documentatie/Documentatie.docx
$ git reset --hard
HEAD is now at 16ca832 delete commit
$ git rm
usage: git rm [<options>] [--] <file>...
-n, --dry-run dry run
-q, --quiet do not list removed files
--cached only remove from the index
-f, --force override the up-to-date check
-r allow recursive removal
--ignore-unmatch exit with a zero status even if nothing matched
$ git reset
$ git reset HEAD
프로젝트를 복원해야 하며 가능하다면 Intellij에서도 복원할 수 있다고 생각하지만 방법을 모르겠습니다.
구체적으로 src 폴더를 복원하고 싶습니다.
답변1
파일과 로컬 변경 사항이 사라졌습니다.
이제 복원할 수 있습니다
- 이전 git 개정판(로컬 변경 사항 없음)
- Intellij에서 (가능한 경우)
- 대상 디렉터리에서 - 실행하지 마세요
mvn clean
- 마지막 빌드/배포의 JAR/WAR 파일 및 .class 파일 디컴파일
- 백업에서