0

I have created a skeleton for a single page application that we intend to use in our company in order to bootstrap our other projects.

This skeleton has its own repository which we pull whenever we need to work on it.

Sometimes I notice that it can be improved so I make changes to it and then copy these changes from the folder that contains the project using the skeleton to the folder that contains the skeleton git repository, make a commit and push everything to the remote repo.

I can think of what Laravel is doing. For example, as a Laravel developer, I could pull the Laravel repository in order to start working on a new project but then I notice that there are some things I could fix.

My workflow doesn't seem very efficient. Are there better ways of doing this?

siannone
  • 6,617
  • 15
  • 59
  • 89

1 Answers1

1

You should use branching in Git, as this is one thing which Git does very well. Instead of working in a separate folder location, you would create a new branch from skeleton and do your improvements there.

git checkout skeleton
git checkout -b feature
# make your improvements
git commit -m 'improvements made'
git push origin feature

Now that your feature branch is on the remote repository, one of your peers can review it. After this, the branch would be merged back into skeleton. If you are using a repo such as GitHub or BitBucket, this process is a bit automated.

Tim Biegeleisen
  • 502,043
  • 27
  • 286
  • 360
  • But the new project may have lots of other stuff that I don't need in the original skeleton repository. Should I ignore these new files using a `.gitignore` file? And what about files that are part of the skeleton repo but shouldn't be pushed back? (like the `routes.php` file in Laravel) – siannone Nov 16 '16 at 10:58
  • If you don't need such changes in `skeleton`, then don't merge and keep the feature branch alive as a parallel version of `skeleton`. As for `routes.php`, yes you can add this file to `.gitignore` if it is effectively not part of your actual source code. The same holds true for library files and binaries. – Tim Biegeleisen Nov 16 '16 at 11:01
  • Makes sense, will experiment on this a bit and will also "spy" what Laravel is doing. Thanks. – siannone Nov 16 '16 at 11:03
  • Come back here if you have a closely related follow up, or ask a new question. Happy to help you. – Tim Biegeleisen Nov 16 '16 at 11:05
  • Oh sorry, forgot to ask you something else. The new project needs also to have its own repository. If that folder has already the skeleton repository in it how do I create a new one then? – siannone Nov 16 '16 at 11:05
  • Why do you want a separate repo? If you must, then use `git clone` and point to the current repo where `skeleton` is: http://stackoverflow.com/questions/651038/how-do-you-clone-a-git-repository-into-a-specific-folder – Tim Biegeleisen Nov 16 '16 at 11:07