siannone siannone - 22 days ago 8
Git Question

Push changes back to pulled repository that is used to bootstrap a new project

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?

Answer

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.