Git pull for all branches in local repository

321 views Asked by At

Seemingly git pull does fetch and merge only for the current branch, is there an easy way to pull for all branches in local repo?

2

There are 2 answers

0
Shreeram K On BEST ANSWER

Try this

for remote in `git branch -r`; do git branch --track $remote; done
git fetch --all
git pull --all
0
Rahul Gupta On

You can use git-up for this. It will automate the process of fetching and rebasing all locally-tracked remote branches. You don't have to type multiple commands again and again. You can achieve this in a single command.

Installation:

gem install git-up

Usage:

git up

This command will then fetch and rebase all the locally-tracked remote branches automatically.

gitup

For more configuration options with git-up, check out this link.