git-ignore | easily list and fetch .gitignore templates | Generator Utils library
kandi X-RAY | git-ignore Summary
kandi X-RAY | git-ignore Summary
Quickly and easily list and fetch .gitignore templates from www.gitignore.io
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of git-ignore
git-ignore Key Features
git-ignore Examples and Code Snippets
Community Discussions
Trending Discussions on git-ignore
QUESTION
Despite having a global gitignore on Windows OS, I am still getting a bunch of "Untracked files".
Below is a truncated list of what it looks like:
...ANSWER
Answered 2022-Jan-25 at 00:42Your problem is that your ignore file is in UTF-16. While UTF-16 is common on Windows, it is practically unused elsewhere outside of some programming languages, and UTF-8 has mostly supplanted it. Git accepts ignore files only in UTF-8 or other ASCII-compatible encodings (in the event your patterns contain non-UTF-8 characters), so you'll need to change your file to be in the proper format for it to work.
I would also recommend using LF endings, although I don't believe those are absolutely required for it to work.
QUESTION
I have a Git repository containing a Java library with two branches: main and jdk8.
The jdk8 branch is the main development branch, with all changes merged into main, whereas the main branch is modular and based on jdk11, with module-info.java files and changes in Gradle build files, different build plugins and modular versions of dependencies, where available. The source code itself is close to identical between the two branches.
What I'd like to do, is to stop developing on the jdk8 branch and start using main as the main development branch, merging changes into the jdk8 branch, from there on.
Some googling led me to these:
How to make empty merge commit (ignoring changes)?
Git - Ignore files during merge
And from that I came up with this strategy:
git checkout jdk8
git merge -s ours main
I have tested this and it looks like it works as expected, that is, allows me to start developing on main and merge the changes into the jdk8 branch, excluding any modified files that don't belong there during merge (perhaps I can use git attributes to exclude the module-info.java files automatically, for example).
On the face of it, this appears quite manageable, but since my understanding of Git is quite rudimentary, I'm wondering if this will cause some problems down the road, is there perhaps a better ("correct" even?) way of doing this?
...ANSWER
Answered 2021-Dec-14 at 11:27It seems like a dangerous flow. Even if you succeed to make the empty merge that will allow you to merge back future changes in main to jdk8, as soon as you will have any new jdk>8 change you will have conflict you will have to resolve manually. For example any change in your module-info.java or in gradle scripts will give you headache... I suggest you 2 options:
(option 1) you can make only the common features to the jdk8 branch and merge them easily to main and jdk>8 devs directly to main
(option 2) you can develop with feature branches from main that you merge back to the main branch and cherry-pick them to jdk8.
(option 3) if you want to keep the history of the feature branches: you can (once the branch is merged into main) to use rebase --onto to get only the interesting commit segment into jdk8
As now the jdk8 branch seems more like a maintenance branch I think that (option 2) is the preferred one
QUESTION
I had a local folder that got pushed to git mistakenly at one point. I fixed it(git-ignored it, deleted it from remote, git pulled, etc.) to get them back in sync.
However, oh-my-zsh (with powerlevel10k
theme) will not change the prompt's git banner back to green.
I have tried restarting iterm
, reloading zshrc
, removing git plugin and adding it back to zshrc
, but none of this works.
Screenshot shows git status is clean, but the prompt still shows git status as yellow instead of green.
...ANSWER
Answered 2021-Oct-12 at 06:34Try first to clone again your repository in a separate, to check if the issue persists (if the zsh prompt, in that new folder, is still incorrect).
From issue 559, you can see what produces the yellow segement:
QUESTION
So I accidentally deleted some files using git clean --
,
when trying to remove them from working directory after creating git-ignore file.
I remember that I had staged them at one point,
so I ran git fsck --dangling
,
and now have a list of blobs, tree and commits.
If I look at the blobs, I only see the content, but not which file the content is from.
I had accidentally deleted some data files (8-3-21.csv, 8-4-21.csv etc). Lot of these data files are similar just with minor changes, so I cannot tell just by the content.
So I want to see if these dangling blobs are associated with the data files I deleted accidentally (2 files).
...ANSWER
Answered 2021-Aug-07 at 06:01If you only staged then unstaged your files, git
has written their content (in blobs) but hasn't stored their names (for some reason, git currently doesn't create a tree object when the index is updated).
If your files are part of these dangling blobs, you are left with identifying them through their content only.
You can use git grep
to grep through a set of git objects.
You can use a trick to find the date when the dangling blob was created : look at the creation date of the file .git/objects/da/nglingblobhash
You may look at the script in this other answer for a way to check the dates of a complete set of blobs.
To answer your comment :
QUESTION
I want to use the pipeline functionality of dvc in a git repository. The data is managed otherwise and should not be versioned by dvc. The only functionality which is needed is that dvc reproduces the needed steps of the pipeline when dvc repro
is called. Checking out the repository on a new system should lead to an 'empty' repository, where none of the pipeline steps are stored.
Thus, - if I understand correctly - there is no need to track the dvc.lock file in the repository. However, adding dvc.lock to the .gitginore file leads to an error message:
...ANSWER
Answered 2021-Jun-22 at 20:24This is definitely possible, as DVC features are loosely coupled to one another. You can do pipelining by writing your dvc.yaml file(s), but avoid data management/versioning by using cache: false
in the stage outputs (outs
field). See also helper dvc stage add -O
(big O, alias of --outs-no-cache
).
And the same for initial data dependencies, you can dvc add --no-commit
them (ref).
You do want to track dvc.lock in Git though, so that DVC can determine the latest stage of the pipeline associated with the Git commit in every repo copy or branch.
You'll be responsible for placing the right data files/dirs (matching .dvc files and dvc.lock) in the workspace for dvc repro
or dvc exp run
to behave as expected. dvc checkout
won't be able to help you.
QUESTION
I am trying to ignore all files and subdirectories from the directory .config
that is located at the root of the repository except the file .config/vimb/config
and the subdirectory .config/ranger/
.
This is my .gitconfig
:
ANSWER
Answered 2021-May-04 at 07:18First, you can check at any point why a file is still ignored with:
QUESTION
For the life of me I can't seem to 'remove' an untracked sub-module/directory from the main git repository. I've tried various syntaxes, but I keep getting the 'pathspec' error stating there was no match, even though the folder is there in plain site. I added it to the .gitignore
and it has not been added or committed to the main repository at all yet, but it keeps showing up in red under Untracked files:
when I run git status
and I can't get rid of it. git clean -n
shows nothing either.
Any clues as to what I'm doing wrong here?
To be clear: I don't want to delete the sub-repo, I merely want to track the sub-repo entirely separately and have the main-repo totally ignore it as if it does not exist.
...ANSWER
Answered 2021-Feb-11 at 14:56Untracked files are files/directories on disk, which aren't tracked yet by git, and which aren't explicitly ignored either.
You can either tell git to ignore it, or remove that file/directory from disk :
QUESTION
We have a file that contains some useful debug configurations for our software. We want this file to sync onto every developer's machine. But a developer may modify that file, and we really don't want the effects of a particular debug session to be checked in. Similar questions arise for default .ini
files that are synched with git but we want to be able to modify during development but not check in.
We thought we could commit the file once and then add it to .gitignore
file, but that does not work -- the file still shows up as changed in git status
. We also found these commands:
ANSWER
Answered 2021-Feb-04 at 15:27This is not possible with Git, at least not in the way you want.
The answer is given in the Git FAQ.
How do I ignore changes to a tracked file?
Git doesn’t provide a way to do this.
The solution is to use a different file, e.g. default.ini.template
, and add your default values there. Developers then need to copy the file to its real name default.ini
. Since you will most likely use a build automation tool (make, gradle, maven), you can add a task there to perform the copy for you, or add a simple script to the repo which needs to be executed once by the devs.
QUESTION
There are similar questions to this, but I'm pretty new to Git (long-serving TFS user) and am struggling with this. I am nervous about applying the ideas suggested by others without a full understanding of what's actually going on...
After branching/merging successfully for a few months, today the following two merge conflicts are shown when I try to merge a working branch into the main one when creating a pull request:
...ANSWER
Answered 2020-Nov-10 at 09:18An explanation into why these files are suddenly showing, but haven't previously?
Select "Files" from the pictures you post. You can see what changes were made to the conflicting files here.
How to fix the conflicts in either VS or DevOps portal?
You can use a Microsoft extension called Pull Request Merge Conflict Extension. With this extension, you can know where the files of the two branches conflict, and you can manually edit what you choose to keep.
Update:
I found a link that might describe why the slnx.sqlite file
appears. Here is the content of the link:
Currently slnx.sqlite is part of the tracked files. It was probably added by mistake before .gitignore was added. It updates automatically by VS and thus prevent some Git commands from executing since they require all tracked files to be in the unmodified state.
QUESTION
I am planning on migrating on-prem stored projects into the Azure DevOps to enable seamless CI/DI experience.
The Azure key vault will be used to secure the secrets stored in app config files of .Net applications. Therefore, the config files of solutions will NOT contain any sensitive information in them.. all the variables in json
and xml
configuration files are replaced in the pipelines/release
in azure devops
..
But now comes the question - if all secrets are obfulscated in the code repository from all places - then how do you build and test solutions locally in the Visual Studio?
I have came up with several theoretical solutions;
- Store the whole
appsettings.Development.json
files (or specific secrets from these files) inAzure Key Vault
. Then make theVSIX
VS extension, that would be able to connect to the vault and retrieve the settings file (or secret values) for specific solution after the code checkout.
The downside of this approach is that .Net framework (unlike .net core) web applications are using the Web.Config
files, so I am not able to use the separate web.development.config
file for the debugging. XML transformation is not applied during the build as far as I remember.. p.s. I am planning on adding all appsettings.X.json
, Web.X.config
to git-ignore.
- Create an
MsBuild
post-build task, that would connect to the vault and replace the variables (in thebin
folder) before application is started.
The downside is that it is not easy to distribute the MbBuild task among other developers in a team (unlike vsix extension).. HOWEVER - it will allow only mess with values in bin
folder, leaving the code-versioned config files unaffected. This task must be skipped in the azure devops
, naturally.
Are there any common secure approaches for sharing the development configuration files among developers without exposing them to the cloud? At this point I feel like second option is the way to go so I would like to hear any advises from the experts.
...ANSWER
Answered 2020-Oct-16 at 19:00Actually you're able to use Web.Config
for multi environment with SlowCheetah
project - https://github.com/Microsoft/slow-cheetah/. I was using it with success for one my projects.
To the topic - I've considered multiple solutions for your problem:
Use emulators for local environment
For various services in Azure, you can use emulators(Storage Account, Cosmos DB, Service Bus), which allow your devs to develop locally without exposing secrets. Downside - it's hard to share environment with other people.
Use managed development environment
It's not like it's always a bad idea to store development settings in your repository. If you can ensure no sensitive data is stored in development environment, you can always stick to development secrets stored for ease. You can also implement ephemeral development environments, but this would require either a mechanism for rotating secrets or creating environments with the same secrets all the time.
Introduce configuration provider
You don't have to rely on settings loaded from your local file. For all the secrets, you can introduce a configuration provider in your code, which will connect to Key Vault and fetch secrets according to your environment settings. This will be tricky anyway as you have to "identify yourself" somehow in order to be able to connect to Key Vault and read the secrets.
Depending on your needs, I'd go for 1 > 3 > 2.
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install git-ignore
brew tap sondr3/homebrew-taps
brew install git-ignore
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page