To close the quickfix window, you use :cclose, as @statox mentioned in the comments.
This won't affect which code buffer you're viewing, though. Vim doesn't distinguish between the buffer you were looking at originally and the buffers you navigated to via the quickfix, so to go back you are going to have to use Vim's regular buffer switching commands. If ...
I use a shell function to perform git checkout. (I call it gco.)
This function performs some index updating, if the checkout succeeds. (In my case I am interested in updating my cindex, while you want to update your cscope.)
git checkout "$@"
if [ "$ret_status" = 0 ] && [ -n "$POST_GIT_CHECKOUT" ]
Ensure setting the cscope using the following in your ~/.vimrc file:
cs add cscope.out
Once it is done, re-login into the terminal to run cscope.
Jump to a tag: Ctrl]
Jump back: CtrlO
Jump to a tag again: CtrlI
GNU Global's distribution already has a couple of vim scripts that are pretty handy.
Look for 'gtags.vim' and 'gtags-cscope.vim' (the most adequate probably for what you want) in Global's installation directory, and just copy the one you prefer to your 'plugins' dir inside vim's config. The second script will do a
for you, which ...
In the source code directory use the following command:
find . -name '*.cpp' -o -name '*.h' > gtags.files
gtags --accept-dotfiles -c -f gtags.files
This will build the cross reference.
In vim, you can issue the following command to invoke gtags-cscope