ingydotnet / git-subrepo

MIT License
3.24k stars 268 forks source link

How to switch subrepo to another pre-existing branch (equivalent to git checkout)? #616

Closed tdVincentB closed 2 months ago

tdVincentB commented 5 months ago

I can see that the command git subrepo branch can create a new branch, but how do we simply switch to another pre-existing branch (the equivalent to git subrepo checkout)?

This is a simple question and, given its basic need, I guess this is already feasible but it is not clear to me from the README how to achieve it.

By the way, thanks for this great work!

admorgan commented 5 months ago

To change branches you would pass the -b option. For instance to pull from a different branch you would use git subrepo pull -b new_branch lib/ If you want to push to a different branch you would do the same. Something that has come up before is that pushing does not change the local tracking branch, so be aware of that.