[GIT][CLI] Add a new branch from upstream to origin/local forks

Code-talk. Anything related to the Studio, extension developing and phpBB coding.


Post Reply
User avatar
3Di
Founder
Founder
Posts: 1187
Joined: 12 Mar 2018 20:10
Location: Milan (IT) Frankfurt (DE)
Contact:

[GIT][CLI] Add a new branch from upstream to origin/local forks

Post by 3Di »

Today I wanted to make a PR against phpBB but I noticed my fork was missing a new branch, which I needed.

So I opened the terminal (Git Bash) on my PC, from the master branch of the local copy of my fork.


Set the upstream to the phpBB repository (upstream, the original)
git remote add upstream https://github.com/phpbb/phpbb.git


Fetch all there is
git fetch upstream

immagine.png

Set up to track remote branch ‘prep-release-3.3.1′ from ‘upstream’
git checkout prep-release-3.3.1

immagine.png
immagine.png (4.8 KiB) Viewed 48 times

Push from local to my own phpBB fork (origin)
git push origin prep-release-3.3.1

immagine.png
immagine.png (8.02 KiB) Viewed 48 times

Syncronize local/origin/upstream

git checkout prep-release-3.3.1 && git pull https://github.com/phpbb/phpbb.git prep-release-3.3.1 && git push origin prep-release-3.3.1
immagine.png
immagine.png (10.96 KiB) Viewed 47 times

Done. :)

immagine.png

Now we are ready for the next.

🏥 Honour and respect to all our heroes in health care. 🇮🇹
Looking for a specific solution for your site? We will rock you! 🚀


Post Reply