Push한 특정 파일을 리모트에서 삭제하기

Kyle_Kim·2022년 3월 10일
0

이 방법은 머지할 경우 메인브런치(develop)에서도 삭제 되기에 아예 필요 없는 경우에만 사용해야한다

만약 자신이 건들인 부분을 삭제하고 싶다면 develop브런치의 source에서 파일을 찾아가 마지막으로 커밋된 해쉬로 git checkout hash -- file/path로 복구해 다시 커밋 한다면 diff에서 나타나지 않을 것이다.

파일을 완전히 삭제하는 방법

If you want to remove the file from the remote repo, first remove it from your project with --cache option and then push it:

git rm --cache /path/to/file
git commit -am "Remove file"
git push

(This works even if the file was added to the remote repo some commits ago) Remember to add to .gitignore the file extensions that you don't want to push.

profile
Make Things Right

0개의 댓글