git-subrepo icon indicating copy to clipboard operation
git-subrepo copied to clipboard

git subrepo branch checkout

Open electroheadfx opened this issue 3 months ago • 1 comments
trafficstars

How to checkout the branch of a subrepo ?

Actually I do from an e.g. Geometry app:

# make some changes in libs/geometry main branch
touch libs/geometry/geometry-specs-2025.md
git add . && git commit -m "Add geometry-specs-2025.md" 
git push

# I want to push the code to the dev branch I do
git subrepo push libs/geometry -b dev
git push
# it push fine the code on dev, and checkout on dev

Now I want to update from e.g Mida app:

# I do this command, it works because there is a code change in dev
git subrepo pull libs/geometry -b dev
git push
# it pull the code and checkout on dev branch

Now I want merge subrepo dev to main

# I prepare the merge from a clone
git clone [email protected]:[org]/subrepo-geometry.git .tmp (main branch)
cd .tmp
git merge origin/dev
git add . && git commit -m "Merge dev"
git push
cd - && rm -rf .tmp

# Now I can try to switch on main branch and get update
git subrepo pull libs/geometry -b main

# it doesn't work because the code is update to I stay on dev, I try:
git subrepo pull libs/geometry --force -b main
# it doesn't work too

So I need to modify the .gitrepo to checkout on dev is the good approach, why there is not a git subrepo checkout libs/geometry -b dev ?

Maybe I have missed something ?

Thanks

electroheadfx avatar Jul 31 '25 15:07 electroheadfx