15

Is it possible to track folders and files in a local repo but not on a remote so that when you push changes, they don't get pushed remotely? The reason being is that I'm using Beanstalk to deploy a website I'm working on locally. My local repo contains folders for artwork and other content that I want to be able to keep track of changes locally for, but don't want to end up on the production server.

Tyssen
  • 1,569
  • 16
  • 35
  • Just commit and don't push. Where is your git server? Your production server shouldn't be your git repo. You should pull periodically when everything is stable. – beatgammit May 27 '11 at 04:33
  • I'm planning on using Beanstalk to deploy to my server. I'm fairly new to Git and haven't used Beanstalk to do any of this yet. This is going to be my first attempt. – Tyssen May 28 '11 at 05:34

3 Answers3

22

Create a separate git repo just for your graphics. Put it as a subdirectory in the main project. Add the subfolder to .gitignore in your main repo. Then you won't have to mess with submodules, but you can still version your local files.

mainrepo
|
|-- .git
|-- .gitignore (contains "graphicsrepo")
|-- graphicsrepo
|   |
|   |-- .git
|   \-- somefile.jpg
|
\-- html
Chris Eberle
  • 47,994
  • 12
  • 82
  • 119
  • Yep, this was actually what I was thinking about this morning after having slept on the idea. But I'm fairly new to Git, so thought I'd check with peeps who know a bit more about it first. – Tyssen May 28 '11 at 05:33
1

You should create a local branch in addition to the branch that is synced with the remote repository. Having a local branch can be made by....

git branch mybranch

Then you can go between the branches by using the checkout function

git checkout mybranch //now in local branch

git checkout repobranch //now in repository branch

WARNING Make sure when you push, you only push the changes in your repobranch. You don't want to have the changes you've made in the local branch to start appearing in your remote repository

systemizer
  • 355
  • 2
  • 6
0

Make the artworks folders as git submodules and maybe host them separately, even locally on your box. Submodules so that if you just have them as directories of unrelated git repos within your repo ( and adding them to the .gitignore ) you may lose the folders without knowing about it. A submodule allows you to track them.

manojlds
  • 290,304
  • 63
  • 469
  • 417