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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T02:14:11+00:00 2026-06-05T02:14:11+00:00

I’m having some trouble understanding basic git concepts :/ I’m testing on my local

  • 0

I’m having some trouble understanding basic git concepts :/

I’m testing on my local Windows machine before trying some things on my git-controlled site.

I have:

gittesting/repo1:
    file.txt
    ignoreme:
        ignore.txt

and

gittesting/repo2
    file.txt
    ignoreme:
        ignore.txt

Repo2 is a copy of repo1, and ignoreme is already being tracked. The ignore.txt file becomes changed in repo2, but I want to stop tracking it and for git to completely ignore it. The problem is that if I create a .gitignore file and add ignoreme, it’s too late because it’s already being tracked, so I would have to do git rm –cached ignore, but then it’s marked as deleted and if I pulled the commit to repo1, the directory would be deleted instead of being left alone..

To sum it up:

  1. The ignore.txt have different content between the two repos.
  2. I want the ignore.txt contents to remain as they are and be completely ignored by git

I’ve looked online, asked in the IRC, and looked at the very related questions, but can’t find a way to do this. I know the example seems trivial, but it’s exactly what I need to do on my site, where the directory is Forum/cache instead.


edit:

This is a bit of a hack and I’d prefer a better answer, but I ended up doing:

cd repo2
echo "ignoreme" > .gitignore
echo "ignoreme/*" > .gitignore
git rm --cache -r ignoreme
git commit -m "Should ignore now"
cd ../repo1
mv ignoreme ignoreme2
git pull ../repo2
mv ignoreme2 ignoreme
  • 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-06-05T02:14:14+00:00Added an answer on June 5, 2026 at 2:14 am

    If I understand your question correctly, you want repo2 to know about the ignoreme/ directory, but you don’t want Git to care about any modifications to the directory. And git rm --cached won’t help you because you’re telling Git to stop tracking this content from now on.

    Git’s solution for keeping track of content, but fixed at a certain point, is through submodules. This except from the Git Book explains (emphasis added):

    Although rack is a subdirectory in your working directory, Git sees it as a submodule and doesn’t track its contents when you’re not in that directory. Instead, Git records it as a particular commit from that repository.

    You could try the following:

    1. Copy the ignoreme/ directory to a new location, and make it a git repository

    2. Add it back as a submodule in repo2:

      git submodule add file:///path/to/ignoreme ignoreme
      git commit -m"Add ignoreme/ as a submodule"
      

    The ignoreme submodule is now fixed to a particular commit. repo2 is still tracking whatever content is inside the submodule, but any changes to files in ignoreme/ will not be tracked in repo2 unless you commit them in the submodule. Let’s say ignoreme/ignore.txt was modified somehow:

    $ git status
    # On branch master
    # Changes not staged for commit:
    #   (use "git add <file>..." to update what will be committed)
    #   (use "git checkout -- <file>..." to discard changes in working directory)
    #   (commit or discard the untracked or modified content in submodules)
    #
    #       modified:   ignoreme (modified content)
    #
    no changes added to commit (use "git add" and/or "git commit -a")
    

    Even if you run git add ., the changes in ignoreme/ignore.txt will not be added to the index unless they are committed to the submodule like so:

    $ cd ignoreme
    $ git commit -am"Time to change ignore.txt"
    $ cd ..
    $ git add .
    $ git status
    # On branch master
    # Changes to be committed:
    #   (use "git reset HEAD <file>..." to unstage)
    #
    #       modified:   ignoreme
    #
    

    However if you want to forget the local modifications in the submodule:

    $ cd ignoreme
    $ git reset --hard
    $ cd ..
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
I'm having trouble keeping the paragraph square between the quote marks. In firefox the
I have just tried to save a simple *.rtf file with some websites and
For some reason, after submitting a string like this Jack’s Spindle from a text
I am trying to understand how to use SyndicationItem to display feed which is
Basically, what I'm trying to create is a page of div tags, each has
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I am trying to render a haml file in a javascript response like so:
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
We're building an app, our first using Rails 3, and we're having to build

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.