Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Track files in local Git repo but ignore in remote

Tags:

git

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.

like image 709
Tyssen Avatar asked May 27 '11 04:05

Tyssen


2 Answers

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
like image 58
Chris Eberle Avatar answered Oct 12 '22 13:10

Chris Eberle


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

like image 20
systemizer Avatar answered Oct 12 '22 13:10

systemizer