Home / حذف یک فایل که به اشتباه به گیت اضافه و کامیت شده است

حذف یک فایل که به اشتباه به گیت اضافه و کامیت شده است


  1. Open Terminal.
  2. Change the current working directory to your local repository.

  3. To remove the file, enter git rm --cached:

    git rm --cached giant_file
    # Stage our giant file for removal, but leave it on disk
    
  4. Commit this change using --amend -CHEAD:

    git commit --amend -CHEAD
    # Amend the previous commit with your change
    # Simply making a new commit won't work, as you need
    # to remove the file from the unpushed history as well
    
  5. Push your commits to GitHub:

    git push
    # Push our rewritten, smaller commit



     RSS of this page