Search code examples
gitgit-branchgit-rebase

Rebase multiple branches into master with one command


I am working on some abandoned repo that has two dozen feature branches, and I want them in master, is there a way to rebase then all in one command or do I have to do them one by one?


Solution

  • You can do merge in one command:

    # providing the current branch is `master`
    git merge br1 br2 br3
    

    As for rebase, it very much depends on what you mean by "one command". Is the following one command?

    for br in br1 br2 br3; do git rebase master $br; done