Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to ignore files using git-gui (tcl-tk) application?

I'm using the git-gui interface to manage my git project. Despite being ugly –tcl-tk– it's one of the most complete interface out there.

However, I can't find how to ignore files from this interface ?

enter image description here

like image 323
Édouard Lopez Avatar asked Feb 26 '14 16:02

Édouard Lopez


People also ask

How do I ignore files in git gui?

To ignore files in your repository with GitHub Desktop go to the Repository menu and select Repository Settings… With the Repository Settings pop-up open, click the Ignored Files tab. Here you will be able to add file names, directory names, or patterns for Git to ignore in your repository.

How do I set git to ignore files?

If you want to ignore a file that you've committed in the past, you'll need to delete the file from your repository and then add a . gitignore rule for it. Using the --cached option with git rm means that the file will be deleted from your repository, but will remain in your working directory as an ignored file.

Which file to use to ignore a file from git to track?

The . gitignore file tells Git which files to ignore when committing your project to the GitHub repository.

How do I exclude a .git folder?

Local Repository . If there are some files you want to ignore for just this repository, you can put them in . git/info/exclude .


2 Answers

the pragmatic way is, to add this to your git configuration:

git config --global guitool."Add to .gitignore".cmd $'echo "\n$FILENAME" >> .gitignore & git add .gitignore'
git config --global guitool."Add to .gitignore".needsfile yes
git config --global guitool."Add to .gitignore".confirm yes

Usage

After that, you can use it under Tools > Ignore selected file in your git gui. Select a file you want to ignore under Unstaged Changes -> Tools/ignore selected file

Ignore file with git-gui

like image 188
Daniel Schmidt Avatar answered Oct 09 '22 07:10

Daniel Schmidt


If you mean ignore them forever, then add a .gitignore file in the root of your directory (where the .git folder is). List the files or file types separated by a new line like so:

*.pyc
venv
.metadata

If you mean ignoring it temporarily, you can do the .gitignore step or just stage the files you want to commit individually.

like image 21
Dan Hoerst Avatar answered Oct 09 '22 06:10

Dan Hoerst