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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T09:04:39+00:00 2026-05-11T09:04:39+00:00

Previously, the following was my .gitignore file: … config/database.yml .DS_Store Later I created an

  • 0

Previously, the following was my .gitignore file:

... config/database.yml .DS_Store 

Later I created an app_config.yml file in the config directory and committed it.

Now, I realized that I don’t need the app_config.yml file in the git repository. And I modified my .gitignore file:

... config/app_config.yml config/database.yml .DS_Store 

Now, when I commit, that app_config.yml file is still in my repo. I want to remove that file from my repo. How can I do 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. 2026-05-11T09:04:39+00:00Added an answer on May 11, 2026 at 9:04 am

    As mentionned in ‘ignoring doesn’t remove a file ‘
    (the following quote the great article from Nick Quaranto,
    in his blog git ready ‘learn git one commit at a time’):

    When you tell Git to ignore files, it’s going to only stop watching changes for that file, and nothing else.
    This means that the history will still remember the file and have it
    .

    If you want to remove a file from the repository, but keep it in your working directory, simply use:

    git rm --cached <file> 

    However, this will still keep the file in history.

    If you actually want to remove it from history, you really have two options:

    • rewrite your repository’s commits, or
    • start over.

    Both options really suck, and that’s for a good reason: Git tries hard not to lose your data.
    Just like with rebasing, Git forces you to think about these kinds of options since they are destructive operations.

    If you did actually want to remove a file from history, git filter-branch is the hacksaw you’re looking for.
    Definitely read up on its manpage before using it, since it will literally rewrite your project’s commits. This actually is a great tool for some actions, and can do all sorts of stuff like totally removing an author’s commits to moving the project root folder around. The command to remove a file from all revisions is:

    git filter-branch --index-filter 'git rm --cached <file>' HEAD 

    This action can definitely be useful when you need to blow out sensitive or confidential information that may have been placed in your repository

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Using the following as an example (with $db being a previously created database connection
I am trying to use a previously created database following the tutorial: http://www.reigndesign.com/blog/using-your-own-sqlite-database-in-android-applications/ I
I was previously using the following code to determine if a file was an
I have the following method created and previously stock1Label to stock3Label were able to
Currently, I have the following code... file_name = content.split('=')[1].replace('', '') #file, gotten previously fileName
I'm running the following line from the apache logs directory to move older (previously
I am using the following array to add an object that was previously created
I want to define a constant in objective-c. Previously I had the following function:
I am attempting to use a .gitignore file with negated patterns (lines starting with
In my perl code I've previously used the following two styles of writing which

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.