问题
I would like to move some files before doing a git checkout
on a specific branch, and to execute some scripts.
There is no way to do an alias to checkout with my scripts, I really need a hook.
I saw many links and it seems the the pre-checkout hook is not yet implemented. Is there a way to do so?
回答1:
you can use git stash that grab your local changes.
Usually i do next:
git stash -u;
git checkout <branch>;
git stash pop
Execute them in one line with && and you will get way to move your changes across branches.
git stash -u && git checkout <branch> && git stash pop
回答2:
Use `git stash´ may be that you want.
Git Tools - Stashing
来源:https://stackoverflow.com/questions/40725328/how-to-do-a-pre-checkout-with-git