in Education by
There is a file that was being tracked by git, but now the file is on the .gitignore list. However, that file keeps showing up in git status after it's edited. How do you force git to completely forget about it? Select the correct answer from above options

1 Answer

0 votes
by
 
Best answer
To stop tracking a file you need to remove the file from index. For removing a file from the index: git rm --cached Note: This command will not delete a physical file in local it will delete the file from other developers from the next $git pull command. Also, you can go with the following commands git rm -r -- cached. git add . Then commit the file with -am then the file gets updated and then the file cannot be tracked. .gitignore will prevent untracked files from being added so instead of .gitignore you can remove the file from the index so that the file cannot be tracked. For better understanding about these commands go through the following crash course on git that will help you to understand git well

Related questions

0 votes
    How to make Git “forget” about a file that was tracked but is now in .gitignore?...
asked Jan 8, 2021 in Technology by JackTerrance
0 votes
    How to make Git “forget” about a file that was tracked but is now in .gitignore?...
asked Jan 7, 2021 in Technology by JackTerrance
0 votes
    My .gitignore file seems to be being ignored by Git - could the .gitignore file be corrupt? Which file format, ... looking to fix this? Select the correct answer from above options...
asked Feb 3, 2022 in Education by JackTerrance
0 votes
    How can we make ignore file mode (chmod) changes in git?...
asked Jan 8, 2021 by JackTerrance
0 votes
    I pulled a project from GitHub a few days ago. I've since discovered that there are several forks on GitHub, ... those forks I pulled? Select the correct answer from above options...
asked Feb 2, 2022 in Education by JackTerrance
0 votes
    I would prefer to write my commit messages in Vim, but it is opening them in Emacs. How do I configure Git ... for a single project. Select the correct answer from above options...
asked Feb 2, 2022 in Education by JackTerrance
0 votes
    I have used "traditional" version control systems to maintain source code repositories on past projects. I ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Mar 15, 2022 in Education by JackTerrance
0 votes
    Say I'm in a Git repository. I delete a file and commit that change. I continue working and make some ... my original project checkout. Select the correct answer from above options...
asked Feb 2, 2022 in Education by JackTerrance
0 votes
    I have made some changes to a file that has been committed a few times as part of a group of files, but ... former state in the past Select the correct answer from above options...
asked Jan 31, 2022 in Education by JackTerrance
0 votes
    I have a project consisting of a huge amount of data. Because of its size, I can't use a remote GIT repo and push/pull ... -ProjectGit | | |-objects |-project1 | |-refs | |-.git...
asked Apr 26, 2022 in Education by JackTerrance
0 votes
    As asked in this question, I also want to know how to resolve a conflicting git stash pop without ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Apr 2, 2022 in Education by JackTerrance
0 votes
    My git workspace is dirty, there are some local modifications. When I use the command git pull origin master it ... Ansible git module? Select the correct answer from above options...
asked Feb 8, 2022 in Education by JackTerrance
0 votes
    I have a local git repo and when I do a git push, I need the repo to be pushed to my EC2 instance. ... heads/*:refs/remotes/origin/* Select the correct answer from above options...
asked Feb 4, 2022 in Education by JackTerrance
0 votes
    I cloned a Git repository, which contains about five branches. However, when I do git branch I only see one of ... staging * etc... Select the correct answer from above options...
asked Feb 4, 2022 in Education by JackTerrance
0 votes
    I used git pull and had a merge conflict: unmerged: _widget.html.erb You are in the middle of a conflicted merge. ... can I do this? Select the correct answer from above options...
asked Feb 2, 2022 in Education by JackTerrance
...