Wednesday, August 10, 2016

Git: ignore files

Let's say that you executed following lines and got whole bunch of random files that are ready to be checked in when you type git status

git init
git add .
git status

How do you remove them and keep them out of your git repo?
Create .gitignore file and add regex expressions into it to match files that you want to exclude

touch .gitignore
vim .gitignore

<
.gitignore
etc
>

What to do with the files that are already ready to be checked in? Remove them via following commad

git rm --cached FILENAME

Now check what you have going to be committed. Should be all clean by now

git status

Commit!

git commit -m "Initial commit"

1 comment:

  1. Nice Information Keep updating It is nice blog Thank you porovide important information and i am searching for same information to save my time Big Data Hadoop Online Training Bangalore

    ReplyDelete