Reputation: 500
Our team is developing an application and using git for version control. We use master branch for release versions and creating new branches for bug-fixes and development.
The problem is: the development environment has some differences with release environment, we need to change port values and database connections for some files in order to work correctly on development. So everytime I create a branch I use a patch command from a diff I previously created and and a patch again after I finish my work to merge with master again.
So when I create a new branch:
git checkout master
git branch new_branch
git checkout new_branch
patch < changes.diff
And when I finish:
patch -R < changes.diff
git add *
git commit -m "new things"
I think there should be a git command for me to do these patches on git, since these seem so similar to what git should be doing.
Thanks in advance
Upvotes: 1
Views: 121
Reputation: 23228
Have a look at git stash
command. Basically you need yo stash your changes and aplly/pop to new branch. Than you can select what you want to commit and leave changes from stash or unapply from its head using git stash show
command for example. That apply stashed changes to a new branch, for example
Upvotes: 1