# Jekyll keeps replacing file with default file

**URL:** <https://talk.jekyllrb.com/t/jekyll-keeps-replacing-file-with-default-file/1999>\
**Category:** Uncategorized\
**Created:** [July 23, 2018, 10:22am UTC](https://talk.jekyllrb.com/t/jekyll-keeps-replacing-file-with-default-file/1999 "2018-07-23T10:22:01Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Aaron](https://avatars.discourse-cdn.com/v4/letter/a/e19adc/32.png) [@Aaron](https://talk.jekyllrb.com/u/Aaron)\
**Post date:** [July 23, 2018, 10:22am UTC](https://talk.jekyllrb.com/t/jekyll-keeps-replacing-file-with-default-file/1999/1 "2018-07-23T10:22:02Z")

</div>

I’m a beginner with Jekyll. I got the theme from a friend. I can able to run using bundle exec Jekyll serve and view the site locally. When I try to change the code and run serve command. It is replacing the code I change to default code. Please help me to fix this. I have wasted a lot of time on this. Thanks in advance.

---

<div class="post-metadata">

**Author:** ![mmistakes](https://yyz2.discourse-cdn.com/flex030/user_avatar/talk.jekyllrb.com/mmistakes/32/2169_2.png) [@mmistakes](https://talk.jekyllrb.com/u/mmistakes)\
**Post date:** [July 23, 2018, 1:18pm UTC](https://talk.jekyllrb.com/t/jekyll-keeps-replacing-file-with-default-file/1999/2 "2018-07-23T13:18:55Z")

</div>

Are you editing files in the `_site` folder? If you are don’t do that.

Jekyll overwrites that entire folder every time the site is built.

---

<div class="post-metadata">

**Author:** ![kenman345](https://yyz2.discourse-cdn.com/flex030/user_avatar/talk.jekyllrb.com/kenman345/32/1129_2.png) [@kenman345](https://talk.jekyllrb.com/u/kenman345)\
**Post date:** [July 31, 2018, 8:26pm UTC](https://talk.jekyllrb.com/t/jekyll-keeps-replacing-file-with-default-file/1999/3 "2018-07-31T20:26:21Z")

</div>

Like @mmistakes said, if you edit the `_site` folder documents, its not going to be effective as thats the generated pages, not the source used to generate the pages.

Try running `jekyll clean` to have it clean up the folders Jekyll creates during `jekyll serve`. Anything you edit from that point will not be overwritten. When you then run `jekyll serve` after that, it will generate off those changes.

Note: Once you run `jekyll serve` it will make the `_site` folder, and thus any changes made within that folder will be just like you’re mentioning now, and be overwritten.

---

<div class="post-metadata">

**Author:** ![yashumittal](https://yyz2.discourse-cdn.com/flex030/user_avatar/talk.jekyllrb.com/yashumittal/32/1260_2.png) [@yashumittal](https://talk.jekyllrb.com/u/yashumittal)\
**Post date:** [August 4, 2018, 4:21pm UTC](https://talk.jekyllrb.com/t/jekyll-keeps-replacing-file-with-default-file/1999/4 "2018-08-04T16:21:37Z")

</div>

Once you run `bundle exec jekyll serve` for the first time, add `_site` directory to `.gitignore` and forget about it.
