I am new to git and recently get confused about the code below. My question are,
- Why
git branch new_branch
will copy the currentrelease_branch
? - After checkout the new branch, why we could enter a sub directory and just re-checkout an old branch to bring in the old script?
- Why the last checkout line (for old branch) will only restore the files in this subdirectory instead of bringing all scripts or switching to the old branch?
# Say pwd is /home/ab/
git checkout -f $RELEASE_BRANCH
git branch $NEW_REPAIR_BRANCH
git checkout $NEW_REPAIR_BRANCH
cd /home/ab/cd/ef/
rm -r *
git checkout $OLD_REPAIR_BRANCH *
Is there anyone could help me explain the logic? Much appreciate! Btw, I believe they should be able to be simplified as well!