Imaging I have two different branches:
- branch1
- branch2
Now I have written a shell script in branch branch1 named sync.sh (Note that sync.sh is added and committed to that branch) which has following statements:
git checkout branch2
#Now perform some operations on branch2 like pull, commit something and push
git checkout branch1
#Again perform some operations on branch1
Now my question is will this work ? Because when it is switched to branch2, there will be no script in the filesystem on it. So will it execute properly? On my attempt, it seems to be working. But can this thing be relied upon ?