After I cloned the repository I observed that I have only one branch on my machine. I wanted to have all the branches so I can use them without internet during traveling. To download all the branches you need to ..
Clone your repository
for example
git clone https://github.com/MadsLorentzen/ai-job-search
Download all the branches
cd ai-job-search
git fetch --all && for remote in $(git branch -r | grep -v '\->'); do git branch --track "${remote#origin/}" "$remote" 2>/dev/null; done && git fetch --all
What’s happening under the hood
git fetch --all– Updates the information about all remote branches.for remote in...– Loops through all remote branches (excluding the HEAD pointer).git branch --track– Creates a local branch and tracks it to the corresponding remote branch.2>/dev/null– Silences warnings if the local branch (e.g.,main) already exists.