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 6331535
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T18:05:16+00:00 2026-05-24T18:05:16+00:00

Is it possible to refresh a git repository after updating the gitignore file? I

  • 0

Is it possible to “refresh” a git repository after updating the gitignore file?

I just added more ignorations(?) to my gitignore and would like to remove stuff already in the repo matching the new file.

  • 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-24T18:05:17+00:00Added an answer on May 24, 2026 at 6:05 pm

    The solution mentioned in ".gitignore file not ignoring" is a bit extreme, but should work:

    # rm all files
    git rm -r --cached .
    # add all files as per new .gitignore
    git add .
    # now, commit for new .gitignore to apply
    git commit -m ".gitignore is now working"
    

    (make sure to commit first your changes you want to keep, to avoid any incident as jball037 comments below.
    The --cached option will keep your files untouched on your disk though.)

    You also have other more fine-grained solution in the blog post "Making Git ignore already-tracked files":

    git rm --cached `git ls-files -i --exclude-standard`
    

    Bassim suggests in his edit:

    Files with space in their paths

    In case you get an error message like fatal: path spec '...' did not match any files, there might be files with spaces in their path.

    You can remove all other files with option --ignore-unmatch:

    git rm --cached --ignore-unmatch `git ls-files -i --exclude-standard`
    

    but unmatched files will remain in your repository and will have to be removed explicitly by enclosing their path with double quotes:

    git rm --cached "<path.to.remaining.file>"
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I don't know if this is possible but I'd like to refresh the contents
Possible Duplicate: How to rewrite URL without refresh, like GitHub.com Hi all, I have
Is it possible to automatically refresh a website on a timer, like every 15
Is it possible to refresh only one entity in entity framework designer? Every time
Is it possible to refresh parent page from child's child page using javascript. I
Is it possible to refresh only the part of the page? How? the part:
Guys, is it possible to refresh a part of a page in struts without
Possible Duplicates: How do I stop the Back and Refresh buttons from resubmitting my
Is it possible to refresh the routing table on a server running Windows 2003
Is it possible to refresh an UpdatePanel dynamically within a specify time?

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.