Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 629067
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T19:42:18+00:00 2026-05-13T19:42:18+00:00

I accidentally commited log/test.log but have never pushed it. I have since done a

  • 0

I accidentally commited log/test.log but have never pushed it. I have since done a git rm to get rid of it. But when I try to push, I’m still getting a huge amount of data attempting to be transferred. Shouldn’t the git rm fix that problem. If not, how could I fix it?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T19:42:18+00:00Added an answer on May 13, 2026 at 7:42 pm

    Don’t revert the commit and then push because the huge file will still be carried around in the history.

    Given that you haven’t yet pushed it and that the commit you want to redo is the most recent, remove that commit from your history:

    $ git reset HEAD^

    This will return your index to the state it was in on the parent commit (HEAD^). Now you have a mulligan: add and commit the way you meant to the first time around.

    If you’ve made other subsequent commits, you’ll need to git rebase -i <commit> where <commit> is the SHA-1 of the bad commit’s parent.

    For example (and note the SHA-1 will be different in your repo)

    $ git rebase -i 57d0b28

    will drop you in an editor that resembles

    pick 366eca1 This has a huge file
    pick d975b30 delete foo
    pick 121802a delete bar
    
    # Rebase 57d0b28..121802a onto 57d0b28
    #
    # Commands:
    #  p, pick = use commit
    #  r, reword = use commit, but edit the commit message
    #  e, edit = use commit, but stop for amending
    #  s, squash = use commit, but meld into previous commit
    #
    # If you remove a line here THAT COMMIT WILL BE LOST.
    # However, if you remove everything, the rebase will be aborted.
    #

    Replace pick with edit on the line with the heavy commit

    edit 366eca1 This has a huge file
    pick d975b30 delete foo
    pick 121802a delete bar

    Save and quit your editor to return to your shell, where you’ll see a message of the form

    Stopped at 366eca1... This has a huge file
    You can amend the commit now, with
    
        git commit --amend
    
    Once you are satisfied with your changes, run
    
        git rebase --continue

    From there, delete the offending file (--cached removes the file from the index only)

    $ git rm --cached big-nasty-file
    rm 'big-nasty-file'

    amend the commit

    $ git commit --amend

    and finish the rebase

    $ git rebase --continue
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I accidentally committed the wrong files to Git , but didn't push the commit
I have accidentally committed the .idea/ directory into git. This is causing conflicts everywhere
Accidentally I have created file - (just a minus) in a directory and commited
I have a local "master" git repository. Every few hours, I 'git push' my
I accidentally deleted some rows from the database. But I already have daily database
Kind of a strange question, but here is my scenario: I have accidentally added
I've accidentally committed bunch of files locally, but didn't pushed. So basically what I
I have a git repo that I need to get working without conflicts. It
I commited a wrong file, so I wanted to clean it up, but accidentally
I accidentally committed some large test wav files into my repository and they are

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.