Learn Python
Learn Data Structure & Algorithm
Learn Numpy
Learn Pandas
Learn Matplotlib
Learn Seaborn
Learn Statistics
Learn Math
Learn MATLAB
Learn Machine learning
Github Introduction
git setup and configuration
Create and delete repository
Upload code using gitbash
Ignore files
Github Branch
Upload code using gitbash GUI
Learn OpenCV
Learn Deep Learning
Learn MySQL
Learn MongoDB
Learn Web scraping
Learn Excel
Learn Power BI
Learn Tableau
Learn Docker
Learn Hadoop
Suppose you have 10 files. Among those files you don't want to upload 2 files. In this case you will use git
ignore file.
We have to perform git ignore after initialization and before adding files.
Perform initialization
To initialize
The command:
git init
Let's check the current status.
So the command:
git status
In the image we can see the list of files and folders which we want to upload in the orange marked area.
Now suppose among these files and folders you doesn't want to upload or ignore css folder and home page.css
file.
To ignore files run command:
touch .gitignore
After running this command a file will be created in the directory.
Now open the ignore file and inside that file write those files and folders name which you want to ignore.
In the image we can see that I type those files name which I want to ignore.
Now again check the status.
So the command:
git status
In the image we can see, after performing git ignore, when see the status we can't see that file and folder
name which I wanted to ignore(red marked).
Now you can do your next process like adding, commit, etc
1.file_name.extension
Here we direct write the file name and it's extension which we want to ignore.
2. .env
To ignore env file we write like this.
3. *.txt
If we write like this then git will ignore all the files which extension is txt. Now if you want to ignore all
.py or .js extension files then you will write *.py or *.js
4. !main.txt
Ignore all the files except main.txt.
Suppose you wrote: *.py
It means ignore all those files which extension is .py
Now below if we write: !main.py
It means ignore all the .py extension files except main.py file.
5. test?.txt
Suppose you have files test1.txt, test2.txt, test3.txt. In this case, test is common word in each file name.
So write the common word and use question mark on that place which word is changing in the name.
So here test is common and 1, 2, 3 is changing.
That why I wrote: test?.txt
So to ignore these type of files use this method.
6. temp/
Suppose you have a folder name temp. In that folder you have a lot of files. Now you want to ignore all the
files present in that folder.
To do that write: temp/