Running them does not seem like a better idea, and depending on how long it takes to globally redefine your entire project, an unwanted rebuild of the entire database may occur every time you change branches.
If a complete rebuild takes too much time, stick a post-checkout git hook that I wrote to manage non-playable files based on each branch.
For each branch, you simply copy the GTAGS, GRTAGS, GPATH files to a subdirectory with the corresponding name in the .branches directory used by this script, and then the script will change the files every time you change branches.
Personally, I never made the transition from Ctags to global, and I use pretty brute force for the general problem of keeping my TAGS file up to date, which is to use a timer to run an asynchronous shell command to determine if any file has been changed recently than TAGS, and if so, create a new TAGS file. If the new file is different from the old file, I replace the old one and set the Emacs tag completion table to zero so that next time it re-reads the TAGS file.
Thus, restoring the TAGS file is my solution both to change the code in the current branch, and to switch to another branch, so I never had a great reason to use my post-control hook for the purposes I suggested here. Depending on when the timer fires, there may be a delay of several minutes between code changes and the TAGS file, however, a faster response will be more pleasant.
source share