How to fix the problem of executing “gitenv.csh” file failed
The Problem
Today when I checkout from one branch to another branch,I can’t use the command of ‘rsarte_rac_oam’.I guess there has someting wrong with my gitenv,so I execute the gitenv.csh with the command source gitenv.csh but failed.
The Reason
The reason is that whenever we checkout form one branch to another,we should clean some tmp config/files of the last branch.If we don’t do that,it may occur faults.
How To Fix This Problem
- Clean up the submodules
git submodule foreach git clean -dfx
- Clean up lrat
git clean -dfx
- Switch to your local dev branch
git checkout dev
- Fetch the latest from origin/dev and prune any branches that no longer exist
git fetch -p
- Reset your dev branch to match origin/dev
git reset --hard origin/dev
- Update the submodules
git submodule update
- Reset your environment
source gitenv.csh (or gitenv_dul20.csh, or gitenv.sh, or gitenv_dul20.sh)
- If these operations don’t work,you need to create a new repo.
How To Avoid This Problem
- Whenever you change your working branch,please do the command source gitenv.csh at once.