1

I am building a new blog/portfolio site using gatsby, but I am not sure how to use git with this project. I deployed the site successfully, which generated the static files as expected.

I did a git pull today without thinking about it though and now I have all the generated files in my repo. How am I supposed to use git with gatsby without pulling down all the generated files?

https://github.com/joshyap/devblog

I am also unsure how to get my local repo back into working order. I already tried a git reset --hard bcc2f7c to go back to the last commit I made without any issues, but the generated files are still in my local repo.

EDIT: I used the gatsby starter default template, which includes a gitignore file already seen here: https://github.com/gatsbyjs/gatsby-starter-default/blob/master/.gitignore

The real issue is that the generated files made it into my repo and I am unsure how to get things back to a working state.

j0shyap
  • 51
  • 1
  • 5

1 Answers1

2

Try using a .gitignore-file. Just place it in the root of the repo and populate it with folders and files you don't want to keep in the repo.

See here for info: https://git-scm.com/docs/gitignore, or try out a template from here: https://github.com/github/gitignore

Jacob Sievers
  • 506
  • 4
  • 13
  • It seems like the undesirable files have _already_ been committed. So OP should probably also remove the files from the repo: https://stackoverflow.com/a/2047477/5385381 – ksav Jun 11 '19 at 10:02