Skip to content

Instantly share code, notes, and snippets.

@jhoblitt
Created February 12, 2025 17:58
Show Gist options
  • Save jhoblitt/189dc890aa366294c504ce2e129b5412 to your computer and use it in GitHub Desktop.
Save jhoblitt/189dc890aa366294c504ce2e129b5412 to your computer and use it in GitHub Desktop.
How to sync a git branch between github and gitlab.
~ $ cd tmp
~/tmp $ git clone [email protected]:lsst-it/puppet-tailscale.git
Cloning into 'puppet-tailscale'...
remote: Enumerating objects: 219, done.
remote: Counting objects: 100% (219/219), done.
remote: Compressing objects: 100% (106/106), done.
remote: Total 219 (delta 95), reused 206 (delta 84), pack-reused 0 (from 0)
Receiving objects: 100% (219/219), 51.18 KiB | 595.00 KiB/s, done.
Resolving deltas: 100% (95/95), done.
~/tmp $ cd puppet-tailscale/
(main) ~/tmp/puppet-tailscale $ git remote add blockops [email protected]:blockops/puppet-tailscale.git
(main) ~/tmp/puppet-tailscale $ git fetch --all
Fetching origin
Fetching blockops
remote: Enumerating objects: 44, done.
remote: Counting objects: 100% (35/35), done.
remote: Compressing objects: 100% (12/12), done.
remote: Total 17 (delta 7), reused 10 (delta 3), pack-reused 0 (from 0)
Unpacking objects: 100% (17/17), 2.29 KiB | 781.00 KiB/s, done.
From gitlab.com:blockops/puppet-tailscale
* [new branch] main -> blockops/main
* [new branch] pdk-test -> blockops/pdk-test
* [new branch] service_provider -> blockops/service_provider
* [new tag] v0.2.0 -> v0.2.0
* [new tag] v0.3.0 -> v0.3.0
* [new tag] v1.0.0 -> v1.0.0
(main) ~/tmp/puppet-tailscale $ git checkout blockops/main
Note: switching to 'blockops/main'.
You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by switching back to a branch.
If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -c with the switch command. Example:
git switch -c <new-branch-name>
Or undo this operation with:
git switch -
Turn off this advice by setting config variable advice.detachedHead to false
HEAD is now at 45b401f Edit extensions.json
((45b401f...)) ~/tmp/puppet-tailscale $ git log
#
# check that refs are as expected...
#
((45b401f...)) ~/tmp/puppet-tailscale $ git push origin blockops/main:main
Enumerating objects: 7, done.
Counting objects: 100% (7/7), done.
Delta compression using up to 32 threads
Compressing objects: 100% (4/4), done.
Writing objects: 100% (4/4), 403 bytes | 403.00 KiB/s, done.
Total 4 (delta 1), reused 0 (delta 0), pack-reused 0 (from 0)
remote: Resolving deltas: 100% (1/1), completed with 1 local object.
To github.com:lsst-it/puppet-tailscale.git
0e8872b..45b401f blockops/main -> main
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment