How Long should these branches kept for ?
The first answer that pops in my mind here is :
Why are you creating release branch in the first place ?
If you are aiming to be able to provide support to a version in production use then it should live as long as that version lives with your customers. (say LTS support, you could have multiple such branches, making things a tad bit more complex)
If you are separating stabilisation work from on-going new development then once the version is deployed you don't really need that branch anymore. Here this would hint at a continuous delivery pipeline. Any bugs gets their fix in the next release which would occur as frequently as possible. Some push this to considering the master branch as the stable branch deploying multiple times daily. Others will sync to their sprints and release every two to three weeks.
Should you merge it completely back into master ?
As you guess it all depends on why you adopted this branching strategy. for continuous delivery style, since the branch will never be used again then you should treat it just as you would any feature or bugfix branches, likely you would merge it back to the master and forget about it.
If however you are aiming for LTS style then you likely would not merge it back, especially if you have multiple such branches. Here you would apply the fix to all release branches and cherry pick from one of them to merge that fix back in master. In this scenario the last thing you would want to do is to treat it like any other feature branch where changes from master are pulled up into it and conflicts resolved there rather than in the master.
Without knowing more about your product life-cycle and your team's workflow it is difficult to come up with a more precise advice here.
How long should these release branches be kept around for?
As long as you expect to receive an errormessage for that release that you want to reproduce from source-code. I would not remove any release branch at all because a branch has a small kilobyte-footprint on the server. only the delta costs harddisk memorycherry picking
each and every commit on the release branch into master ormerging
release into master is technically the same thing accept that you don't "see" thecherry picks
in the git history. So I'd prefermerging
each fix back into master using gits--no-ff
option so that the history shows the extra release branch.