Reputation: 1208
There are a couple of us working on a git repo. We all have it pulled. There are several feature branches and of course master.
Now the trouble is that one feature has been developed in the master branch but it is incomplete and we can no longer deploy bugfixes to the code in the mean time.
I understand a bit about git but certainly not enough to 'stabilise' the repo and I know that the situation is a complete mess.
How would I go about splitting the pushed commits from master into the correct branch whilst still allowing master to be independently commited, pushed, etc - so that we can continue to perform bugfixes but can later merge the features in.
Any help appreciated.
Upvotes: 1
Views: 48
Reputation: 2613
Create a development
branch off of your current master
. Push any dev efforts into developement
, and re-create master
to point to the latest stable version.
For bug fixes, take out a branch from the new master
, work on it, test it, tag it, and merge it back to master
. This way the rest of your team can continue working on other features, which bug-fixes can be merged into master
and released as a patch.
See git branching model.
Assuming you have a tag to a stable release (or at least the commit hash to it) you can do this:
//lets sync origin master and local master
git checkout master //checkout local copy of master
git pull origin master //grab any changes in origin/master
git push //now origin and local are in sync
//create development branch off of master
git checkout -b development master
git push origin development:development
//now point master to release tag
git branch -d master
git checkout -b master tag_name
git push -f origin master:master
Now have everyone merge development into their feature branches. Bug fixes go into master.
Upvotes: 2