I\'m working first time on git. I have pushed my branch on github and it pushed all the library and documents into the github. Now what can I do and how can I use gitignore comm
If you dont have a .gitignore file, first use:
touch .gitignore
then this command to add lines in your gitignore file:
echo 'application/cache' >> .gitignore
Be careful about new lines
So based on what you said, these files are libraries/documentation you don't want to delete but also don't want to push to github
. Let say you have your project in folder your_project
and a doc directory: your_project/doc
.
git rm --cached doc/*
.gitignore
, you can make one right inside of your project folder: project/.gitignore
. doc/*
in the .gitignore git add project/.gitignore
git commit -m "message"
. github
.There is a file in your git root directory named .gitignore
. It's a file, not a command. You just need to insert the names of the files that you want to ignore, and they will automatically be ignored. For example, if you wanted to ignore all emacs autosave files, which end in ~
, then you could add this line:
*~
If you want to remove the unwanted files from your branch, you can use git add -A
, which "removes files that are no longer in the working tree".
Note: What I called the "git root directory" is simply the directory in which you used git init
for the first time. It is also where you can find the .git
directory.
If you don't have a .gitignore file. You can create a new one by
touch .gitignore
And you can exclude a folder by entering the below command in the .gitignore file
/folderName
push this file into your git repository so that when a new person clone your project he don't have to add the same again
There are several ways to use gitignore git
just create a .gitignore file and write in whatever you want to ignore a sample gitignore file would be:
# NPM packages folder.
node_modules
# Build files
dist/
# lock files
yarn.lock
package-lock.json
# Logs
logs
*.log
npm-debug.log*
# node-waf configuration
.lock-wscript
# Optional npm cache directory
.npm
# Optional REPL history
.node_repl_history
# Jest Coverage
coverage
.history/
You can find more on git documentation gitignore
on my mac i found this file .gitignore_global
..it was in my home directory hidden so do a ls -altr
to see it.
I added eclipse files i wanted git to ignore. the contents looks like this:
*~
.DS_Store
.project
.settings
.classpath
.metadata