3,037 questions
2
votes
1
answer
74
views
Stop tracking files that match the patterns in a newly added .gitignore file
When you inherit a code base where gitignore has not been used then the first thing you want to do is add a standard gitignore file like this one Standard Visual Studio gitignore file for example. But ...
1
vote
1
answer
989
views
How to handle a gitignore'd file in another branch
This has probably been asked before but I couldn't find it.
Switch from the main branch to the newfeature branch.
Create a file feature.log, add it to .gitignore, and commit.
Switch back to the main ...
0
votes
1
answer
159
views
Which command lists all the existing files ignored by Git [duplicate]
I would like to get the all existing files ignored by git repository or in my local also if it is possible and explaining the command
I have tried this commands but not working.
git ls-files --...
2
votes
1
answer
121
views
How to do `git clean -X -e` with overlapping ignores?
I have a curious case with git clean -X. I want to delete all ignored files in a clone, except the .vs folder (which is ignored but should not be deleted).
This works with git clean -Xnd -e !.vs - ...
1
vote
0
answers
118
views
In git, is there a way I can ignore any changes to a file, but still have that file exist in the repo for everyone to pull down?
I have a file in my repo that contains sensitive information relevant to each dev. I want each of my colleagues to have this file when they pull down my repo and update it with their info, but not be ...
1
vote
2
answers
96
views
Git ignore all files directly in folder
Suppose you have the following folder structure:
a
├─ b
│ ├─ b1.txt
│ └─ b2.txt
├─ a1.txt
└─ a2.txt
.gitignore
How do you tell Git to ignore a1.txt, a2.txt and all other files directly in the &...
1
vote
1
answer
97
views
How to definitely and forever ignore locally edited files in a specific dir [duplicate]
I'm using git 2.38.1.
I need to clone the project from remote, edit some docker config files and maintains that changes only locally also while changing branches.
I tried:
.git/info/exclude
assume-...
1
vote
1
answer
86
views
How to recover previously tracked (now ignored) environment files that are deleted by git after returning in a detached state
I am working on an angular project and mistakenly commits the environment files that have some apikeys on it. It has been after a couple of commits that I noticed that I accidentally committed the env ...
0
votes
2
answers
160
views
How to gitignore a nested repository?
My git repository has a nested repository that I want to ignore:
my_repo/
main.py
test_data/
.git/
test_file.txt
.gitignore
In the .gitignore file, I tried adding the following:
...
-2
votes
2
answers
63
views
How do i convert a text file type to unity3d ignore file type?
I unchecked in the file explorer the option for Hide extensions for known file types
then in the folder itself i have a text file name Unity.gitignore.txt , the file was type gitignore i downloaded ...
2
votes
1
answer
78
views
git ignore whole directory apart from files with a specific extension
I would like to have lines in my .gitignore file that ignore an entire directory and its subdirectories, aside from any files (and their folder structure) that end .pdf
At the moment i use;
outputs/*
!...
0
votes
1
answer
166
views
Backing up gitignored files?
I often hear that we should always make local backups to remote repositories for archiving or disaster recovery purposes.
I don't know if it is just me that's doing things differently/incorrectly. ...
1
vote
1
answer
151
views
How to convert gitignore to pathspec
How to reliably convert a .gitignore file into a list of pathspec strings that can be passed to individual git commands?
I want to have a javascript function that can take any .gitignore file as input,...
1
vote
1
answer
78
views
Can an asterisk * match nothing in .gitignore?
Given that
gitignore use Glob pattern instead of regular expression
The official guide tells that an asterisk * matches anything except a slash /
I am wondering if an asterisk * can match just ...
0
votes
2
answers
121
views
Delete any file or folder with a pattern from git cache and previous commits
I want to remove any files or directories that match the following patterns:
**/.*
**/__*
I tried the following commands:
find . -path './.git' -prune -o -name '.*' ! -name '.' -exec git rm --cached ...
0
votes
1
answer
123
views
make git ignore everything except all .c, .cpp and .py files
I want to make git ignore all files except *.c, *.cpp and *.py.
I tried this:
*
!*.c
!*.cpp
!*.py
but this didn't work; it ignored even the *.c, *cpp and *.py files.
git status result before adding ...
-1
votes
2
answers
129
views
Is there a way to configure a secondary .gitignore file specific to each machine I've cloned to?
I have a GitHub repository to sync my projects across my local machine and a few clusters I can access. There are a few different files that I'd like hosted on my cluster directories that I do not ...
1
vote
0
answers
225
views
What is "deviceStreaming.xml" in Android Studio?
This file
[ProjectRoot]/.idea/caches/deviceStreaming.xml
doesn't get ignored by git-VersionControlSystem when I add the
".idea" line to ".gitignore"
Also, the file "...
-1
votes
1
answer
191
views
Hide changes to files in my `.vscode` dir from VS Code Source Control / Changes without editing `.gitignore`
When working on public projects from GitHub using VS Code sometimes changes keep showing up in the Source Control panel that I'm not interesting in seeing.
But I don't want to change .gitignore ...
1
vote
1
answer
191
views
Shopware 6 - Ignore plugin builds in Git
How can plugin builds in Shopware 6.6+ be excluded from Git? I am speaking of storefront- and administration builds. These have dynamic paths under custom/plugins.
This is a bit annoying in the ...
0
votes
1
answer
446
views
What files do I commit to GitHub from npm create vite@latest?
I'm a new software developer still in my instructional phase. I just created my first React project using npm create vite@latest. I'm wondering what files I would commit to my repo, and which files ...
2
votes
2
answers
287
views
Preserve ignored untracked files across checkout
I picked up an external project, which I will be developing from now on.
As a failsafe measure, I made 2 branches:
One without a .gitignore, so as to not lose untracked files, called gitignoreless.
...
2
votes
1
answer
122
views
why is git file not tracked in git?
In my git project, the file dir-name/file.txt is not tracked by git, but I want it to be tracked.
In git status the file is not listed in the tracked files and not in the untracked files. git add dir-...
0
votes
2
answers
53
views
.gitignore: I want to create an exclusion for my [Bb]in/ ignore line with no success
I have the following in my .gitignore:
[Bb]in/ # this is line 164
# Allow bin directories and their contents under any artifacts folder
!*/artifacts/[Bb]in
!*/artifacts/[Bb]in/
!*/artifacts/[Bb]in/**
...
0
votes
0
answers
37
views
On restart, VS Code fails to ignore a directory listed in `.gitignore` containing a second repo
I am using Nanoc as a static site generator, managed with GIT.
Nanoc creates an "output" directory in the site’s main repo. This is explicitly excluded in the site's main .gitignore file ...
1
vote
1
answer
120
views
The difference between .gitignore and .Rbuildignore
I might be asking a dumb questions but can someone tell me the difference between .gitignore and .Rbuildignore when developing a R package with GitHub? Thanks.
EDIT: could you explain what kind of ...
-1
votes
2
answers
182
views
Best way to keep your mySQL info out of a public repo [duplicate]
I am working on a website and using git. The repo is public but I don't want the mySQL info to be part of it. Should I just put the connection code in a file then block that file with .gitignore?
Is ...
1
vote
1
answer
769
views
Android Studio: Should *.toml files be version controlled?
I've been using Android Studio for years, but only recently have I started seeing files with the *.toml suffix. I see that they work with gradle files, but I have been migrating to kotlin instead of ...
0
votes
1
answer
45
views
Delete and stop tracking folders from client branch but keep them on main product branch
I've branch out client branch (C) from main product (P) branch which I am adding features as per request. The main product branch contains all folders/files for every client with the main product code....
2
votes
1
answer
126
views
Gitignore all folders beginning with a period except those with a `.gitignore` file
Many tools that I use create hidden folders such as .mypy_cache, .ruff_cache, .ipynb_checkpoints, etc.
Generally, I want to git-ignore such folders, as they often only contain cached data.
However, if ...
0
votes
0
answers
20
views
Cannot add files to .gitignore in React application repository [duplicate]
I am using VS code with the Git extensions to manage version control and push/pull commits to my repository. I am creating a React application that has a public folder, a node_modules folder, an src ...
0
votes
2
answers
338
views
Gitignore asterisk "*" and slashes
According to the gitignore documentation, an asterisk * matches anything except a slash. It's not clear to me how that actually works in practice.
Consider the following structure for example:
foo/
...
0
votes
3
answers
209
views
Ignore file extension except in a specific directory in `.gitignore` [closed]
In my repository, I have scripts that generate loads of .json files, that I want to ignore, so I have *.json in .gitignore. But I have one directory config containing .json files and I want those to ...
1
vote
1
answer
52
views
MDriven Framework file Modlr.config - can it be ignored from git?
Using MDriven Framework, can we safely ignore modlr.config from git? It seems to be modified whenever I even just open the model editor, without changing anything. Does it contain anything that's ...
0
votes
2
answers
156
views
Match end of file name in .gitignore
In a git repo, I want to exclude a file named main but not a file named main.c. How would I do this?
If I add this to the .gitignore file:
main
both files are excluded. How do I match a pattern at ...
0
votes
0
answers
79
views
With git, how to minimize pain when switching between branches with differing .gitignores?
I am in a position where I switch branches in a single repo regularly, working on my own projects, and reviewing collaborator’s code by running it. Often new code will generate intermediary files that ...
1
vote
0
answers
35
views
Git subtree/ + inter-related gitignore
I want to setup a git project with a nested repo. so far my attempts with gitignores or git subtree dont catch all I need.
A) main repo
B) nested repo (core theme)
The nested repo contains a folder ...
5
votes
2
answers
2k
views
Should I add components.d.ts to gitignore?
components.d.ts is auto-generated by unplugin-vue-components when dev server starts. It often cause conflicts when merging PRs in the projects I have participated in.
components.d.ts looks like:
/* ...
2
votes
0
answers
136
views
Should we gitignore `Package.realitycomposerpro/WorkspaceData` for Reality Composer Pro projects?
Should we add Package.realitycomposerpro/WorkspaceData/* to .gitignore for Reality Composer Pro projects?
I see files with my computer name and other JSON files in here that are highly updated by just ...
-1
votes
2
answers
126
views
My .gitignore file is NOT ignoring anything [closed]
Is there any particular valid reason as to why my .gitignore file is ignoring the fact that I have told this file to ignore all of my newly-created, previously-uncommitted files that I have included ...
1
vote
0
answers
393
views
Expo gitignore ios and android folders
My generated info.plist has some identifiers such Google Login client ID. While this isn't a "secret", I don't want to commit this to a public git repo.
Given the entire ios and android ...
1
vote
1
answer
341
views
Should I put Django venv directory in .gitignore?
In my book Python Crash Course 2nd edition it is recommended to put ll_env (venv directory) in .gitignore.
It says, "We tell Git to ignore the entire ll_env directory, because we can re-create
it ...
0
votes
1
answer
98
views
How to synchronize changes from a source repo to a destination repo triggered from a push to the source main except some files
I want to synchronize changes from a source repository to a destination repository whenever there is a push to the main branch of the source repository. However, I do not want to sync changes to the ...
2
votes
0
answers
150
views
git: untracked files not being ignored [closed]
So, i'm doing a little project with rust and i would also like to use git in order to learn both in a more practical way. The problem started when i created gitignore, because in rust, both the "...
-1
votes
1
answer
84
views
File is added to .gitignore but is still shown in "Working directory changes" [duplicate]
I'm working with files with a specific filename, something like:
Site/Product Client/Modules/Product.Customer.Client.dll
(The words "Product" and "Customer" are replaced by ...
0
votes
1
answer
52
views
Unstaged files that were accidentally uploaded to GitHub before there was a gitignore file
My friends and I are working on a project in github but by mistake changes were pushed to master before a gitignore file was uploaded that indicates to ignore these files
And when someone wants to ...
-1
votes
1
answer
60
views
Do I need to commit my .gitignore with paths containing spaces to see changes in my status?
I have a .gitignore which ignores all .docx files. I want to add an exception, BUT I just made multiples commits with modification to my .gitignore file and I still can't see my docx.
The first thing ...
-1
votes
2
answers
69
views
gitignore file inside a folder and want to exclude a folder outside that
I have my current repo setup like below
project/
├── .cicd
├── .github
├── .idea
├── .primer
├── airflow/
└── module/
└── .gitignore
I have my .gitignore file inside module folder.
Now, I want to ...
0
votes
0
answers
53
views
How to properly exclude specific files from .gitignore
I'm trying to get a .gitignore working in wordpress. I want to exclude the uploads files and the temporary plugin upgrade files, but not ignore the .htaccess and index.html static files in those ...
0
votes
0
answers
137
views
The file cannot be removed even though it is included in the .gitignore list
I have a Flutter project that initially did not have a .gitignore file. After adding the .gitignore file and cleaning up with the following commands:
git rm -r --cached .
git add .
git commit -m "...