i_priyanshu
i_priyanshu

Reputation: 89

How can i exclude ".exe" file types from my git commit?

I can exclude single files from my git commit but I want to exclude all files which have .exe file type.

Upvotes: 5

Views: 11142

Answers (2)

yadhukrishna
yadhukrishna

Reputation: 11

You can simply make a .gitignore file in your git initialised folder

touch .gitignore

You can open that gitignore file with any of text editor and write *.exe to ignore the .exe file from adding to the version control . If already .exe is being commited you can simply delete it and make a new commit

Upvotes: 0

sajjad rezaei
sajjad rezaei

Reputation: 1043

you can use regex as a pattern in the git ignore file as bellow:

# Ignore all
*

# Unignore all with extensions
!*.*

# Unignore all dirs
!*/

### Above combination will ignore all files without extension ###

# Ignore files with extension `.class` & `.exe`
*.class
*.exe

# Ignore `bin` dir
bin/
# or
*/bin/*

# Unignore all `.exe` in `bin` dir
!*/bin/*.exe

Upvotes: 6

Related Questions