Updating a widgets fork with new branches - 24i/fokuson-developer-portal GitHub Wiki

Updating a widgets fork with new branches

When you get a new major version of widgets from Nordija. You will also get a new branch in the widgets repository.

The new branch is not automatically added to the fork that you have created of the widgets repository. To get the new branch to your fork you need to follow these steps.

  • Clone the fork to your local machine.
#!shell
git clone https://<username>@bitbucket.org/<name>/widgets-revo2.git 

Cloning into 'widgets-revo2'...
remote: Counting objects: 7690, done.
remote: Compressing objects: 100% (4099/4099), done.
remote: Total 7690 (delta 4088), reused 6457 (delta 2949)
Receiving objects: 100% (7690/7690), 19.88 MiB | 13.69 MiB/s, done.
Resolving deltas: 100% (4088/4088), done.

  • Enter the clone directory
#!shell
cd ./widgets-revo2

  • Check the remotes on the clone.
#!shell
git remote -v

origin	https://<username>@bitbucket.org/<workspace>/widgets-revo2.git (fetch)
origin	https://<username>@bitbucket.org/<workspace>/widgets-revo2.git (push)
  • Add upstream to the remotes. Here you need the URL for the repository that you have forked from.
#!shell
git remote add upstream https://<username>@bitbucket.org/nordija/widgets-revo2.git
  • Check that the remote was added.
#!shell
git remote -v

origin	https://<username>@bitbucket.org/<workspace>/widgets-revo2.git (fetch)
origin	https://<username>@bitbucket.org/<workspace>/widgets-revo2.git (push)
upstream	https://<username>@bitbucket.org/nordija/widgets-revo2.git (fetch)
upstream	https://<username>@bitbucket.org/nordija/widgets-revo2.git (push)
  • Now you can fetch the branches from the repository that you have forked.
#!shell
git fetch upstream
  • To view all the branches in the clone
#!shell
git branch -a

* bugfix_3_26
  master
  remotes/origin/HEAD -> origin/master
  remotes/origin/bugfix_3_25
  remotes/origin/bugfix_3_26
  remotes/origin/master
  remotes/upstream/bugfix_3_25
  remotes/upstream/bugfix_3_26
  remotes/upstream/bugfix_3_27
  remotes/upstream/master
  • Now check out the upstream branch
#!shell
git checkout -b <branch name> upstream/<branch name>

git checkout -b bugfix_3_27 upstream/bugfix_3_27

Branch 'bugfix_3_27' set up to track remote branch 'bugfix_3_27' from 'upstream'.
Switched to a new branch 'bugfix_3_27'
  • Now you can check that the new branch was added but listing all branches
#!shell
git branch -a

  bugfix_3_26
* bugfix_3_27
  master
  remotes/origin/HEAD -> origin/master
  remotes/origin/bugfix_3_25
  remotes/origin/bugfix_3_26
  remotes/origin/bugfix_3_26-1
  remotes/origin/master
  remotes/upstream/bugfix_3_25
  remotes/upstream/bugfix_3_26
  remotes/upstream/bugfix_3_27
  remotes/upstream/master

  • Now you can push the new branch to the remote
#!shell
git push -u origin <branch name>

git push -u origin bugfix_3_27

Enumerating objects: 2270, done.
Counting objects: 100% (2270/2270), done.
Delta compression using up to 16 threads
Compressing objects: 100% (923/923), done.
Writing objects: 100% (1990/1990), 875.63 KiB | 26.53 MiB/s, done.
Total 1990 (delta 1211), reused 1663 (delta 952)
remote: Resolving deltas: 100% (1211/1211), completed with 176 local objects.
remote: 
remote: Create pull request for bugfix_3_27:
remote:   https://bitbucket.org/<workspace>/widgets-revo2/pull-requests/new?source=bugfix_3_27&t=1
remote: 
To https://bitbucket.org/<username>/widgets-revo2.git
 * [new branch]      bugfix_3_27 -> bugfix_3_27
Branch 'bugfix_3_27' set up to track remote branch 'bugfix_3_27' from 'origin'.
  • Now you can check that the new branch is pushed to the origin
#!shell
git branch -a

  bugfix_3_26
* bugfix_3_27
  master
  remotes/origin/HEAD -> origin/master
  remotes/origin/bugfix_3_25
  remotes/origin/bugfix_3_26
  remotes/origin/bugfix_3_27
  remotes/origin/master
  remotes/upstream/bugfix_3_25
  remotes/upstream/bugfix_3_26
  remotes/upstream/bugfix_3_27
  remotes/upstream/master

Now the new branch is added to your fork and you can see it on bitbucket.

⚠️ **GitHub.com Fallback** ⚠️