branch change documentation #10642

Closed
opened 2025-12-29 21:34:03 +01:00 by adam · 15 comments
Owner

Originally created by @opericgithub on GitHub (Jan 13, 2025).

Change Type

Addition

Area

Installation/upgrade

Proposed Changes

With the default branch being changed from master to main, the documentation should include clear instructions for upgrading from version 4.1 to 4.2.

Previously, the upgrade process was straightforward using the following commands:

sudo git pull origin master
sudo ./upgrade.sh

However, these commands no longer work, leaving users on the latest 4.1 version. While the current documentation mentions the following command for a specific version:

sudo git checkout v4.2.0

It would be beneficial to standardize the process so that all future upgrades can be performed consistently with the following command:

sudo git pull origin main

This change would simplify the process and reduce confusion for users.

Originally created by @opericgithub on GitHub (Jan 13, 2025). ### Change Type Addition ### Area Installation/upgrade ### Proposed Changes With the default branch being changed from master to main, the documentation should include clear instructions for upgrading from version 4.1 to 4.2. Previously, the upgrade process was straightforward using the following commands: ` sudo git pull origin master ` `sudo ./upgrade.sh ` However, these commands no longer work, leaving users on the latest 4.1 version. While the current documentation mentions the following command for a specific version: ` sudo git checkout v4.2.0 ` It would be beneficial to standardize the process so that all future upgrades can be performed consistently with the following command: ` sudo git pull origin main ` This change would simplify the process and reduce confusion for users.
adam added the type: documentationstatus: needs ownerpending closure labels 2025-12-29 21:34:03 +01:00
adam closed this issue 2025-12-29 21:34:03 +01:00
Author
Owner

@reduzent commented on GitHub (Jan 13, 2025):

Up to v4.1.10, master was always pointing to a release version (e.g v4.1.10) and never to between-releases version. However, since the switch to main as default branch, git pull doesn't necessarily give you the most recent release, but some current development version. Is that change intentional?

@reduzent commented on GitHub (Jan 13, 2025): Up to v4.1.10, master was always pointing to a release version (e.g v4.1.10) and never to between-releases version. However, since the switch to `main` as default branch, `git pull` doesn't necessarily give you the most recent release, but some current development version. Is that change intentional?
Author
Owner

@litebito commented on GitHub (Jan 13, 2025):

Maybe also add the other steps we (who are not always used to work with git) have to do when we are making this change, for example, when I switch from master to main:

# sudo git pull origin main
remote: Enumerating objects: 295, done.
remote: Counting objects: 100% (194/194), done.
remote: Compressing objects: 100% (33/33), done.
remote: Total 55 (delta 42), reused 30 (delta 20), pack-reused 0 (from 0)
Unpacking objects: 100% (55/55), 16.45 KiB | 432.00 KiB/s, done.
From https://github.com/netbox-community/netbox
 * branch                main       -> FETCH_HEAD
hint: You have divergent branches and need to specify how to reconcile them.
hint: You can do so by running one of the following commands sometime before
hint: your next pull:
hint:
hint:   git config pull.rebase false  # merge
hint:   git config pull.rebase true   # rebase
hint:   git config pull.ff only       # fast-forward only
hint:
hint: You can replace "git config" with "git config --global" to set a default
hint: preference for all repositories. You can also pass --rebase, --no-rebase,
hint: or --ff-only on the command line to override the configured default per
hint: invocation.
fatal: Need to specify how to reconcile divergent branches.

Not 100% sure what to do here
(I don't do any local Netbox development nor do I make code changes)

@litebito commented on GitHub (Jan 13, 2025): Maybe also add the other steps we (who are not always used to work with git) have to do when we are making this change, for example, when I switch from master to main: ``` # sudo git pull origin main remote: Enumerating objects: 295, done. remote: Counting objects: 100% (194/194), done. remote: Compressing objects: 100% (33/33), done. remote: Total 55 (delta 42), reused 30 (delta 20), pack-reused 0 (from 0) Unpacking objects: 100% (55/55), 16.45 KiB | 432.00 KiB/s, done. From https://github.com/netbox-community/netbox * branch main -> FETCH_HEAD hint: You have divergent branches and need to specify how to reconcile them. hint: You can do so by running one of the following commands sometime before hint: your next pull: hint: hint: git config pull.rebase false # merge hint: git config pull.rebase true # rebase hint: git config pull.ff only # fast-forward only hint: hint: You can replace "git config" with "git config --global" to set a default hint: preference for all repositories. You can also pass --rebase, --no-rebase, hint: or --ff-only on the command line to override the configured default per hint: invocation. fatal: Need to specify how to reconcile divergent branches. ``` Not 100% sure what to do here (I don't do any local Netbox development nor do I make code changes)
Author
Owner

@litebito commented on GitHub (Jan 16, 2025):

anyone who can tell me what I should do after the above message?

@litebito commented on GitHub (Jan 16, 2025): anyone who can tell me what I should do after the above message?
Author
Owner

@opericgithub commented on GitHub (Jan 16, 2025):

I also don't know. I hope someone will help us and change the documentation.

@opericgithub commented on GitHub (Jan 16, 2025): I also don't know. I hope someone will help us and change the documentation.
Author
Owner

@litebito commented on GitHub (Jan 16, 2025):

For now, I used

cd /opt/netbox
sudo git checkout v4.2.1 (SELECT THE VERSION YOU NEED/WANT)
sudo PYTHON=/usr/bin/python3.12 /opt/netbox/upgrade.sh
sudo systemctl restart netbox netbox-rq
sudo systemctl status netbox netbox-rq

(and then the upgrade gave a database error, but that is a different story)

it looks like checking the specific version is the way forward....

@litebito commented on GitHub (Jan 16, 2025): For now, I used ``` cd /opt/netbox sudo git checkout v4.2.1 (SELECT THE VERSION YOU NEED/WANT) sudo PYTHON=/usr/bin/python3.12 /opt/netbox/upgrade.sh sudo systemctl restart netbox netbox-rq sudo systemctl status netbox netbox-rq ``` (and then the upgrade gave a database error, but that is a different story) it looks like checking the specific version is the way forward....
Author
Owner

@fixed77 commented on GitHub (Jan 27, 2025):

Has anyone been able to switch the branch to a new one?

@fixed77 commented on GitHub (Jan 27, 2025): Has anyone been able to switch the branch to a new one?
Author
Owner

@pentiumoverdrive commented on GitHub (Feb 13, 2025):

wondering as wel how to perform this smoothly, stuck on v4.1.3.

@pentiumoverdrive commented on GitHub (Feb 13, 2025): wondering as wel how to perform this smoothly, stuck on v4.1.3.
Author
Owner

@litebito commented on GitHub (Feb 13, 2025):

@pentiumoverdrive
@fixed77

Just trying to help:
I stopped using the "branch way" of doing upgrades.
Following the new way of upgrading:

cd /opt/netbox
sudo git fetch --tags
sudo git checkout v4.2.3 (SELECT THE VERSION YOU NEED/WANT)
sudo PYTHON=/usr/bin/python3.12 /opt/netbox/upgrade.sh
sudo systemctl restart netbox netbox-rq
sudo systemctl status netbox netbox-rq

this is also the official documented upgrade process when using git:
https://netboxlabs.com/docs/netbox/en/stable/installation/upgrading/

I upgraded from 4.1.3 to 4.2.1 that way, and have gone through upgrades 4.2.2 and 4.2.3 like this... so far no issues (except for that database issue, but that was not related to the branching stuff)

@litebito commented on GitHub (Feb 13, 2025): @pentiumoverdrive @fixed77 Just trying to help: I stopped using the "branch way" of doing upgrades. Following the new way of upgrading: ``` cd /opt/netbox sudo git fetch --tags sudo git checkout v4.2.3 (SELECT THE VERSION YOU NEED/WANT) sudo PYTHON=/usr/bin/python3.12 /opt/netbox/upgrade.sh sudo systemctl restart netbox netbox-rq sudo systemctl status netbox netbox-rq ``` this is also the official documented upgrade process when using git: https://netboxlabs.com/docs/netbox/en/stable/installation/upgrading/ I upgraded from 4.1.3 to 4.2.1 that way, and have gone through upgrades 4.2.2 and 4.2.3 like this... so far no issues (except for that database issue, but that was not related to the branching stuff)
Author
Owner

@InsaneSplash commented on GitHub (Feb 13, 2025):

Pity you need to specify the version, as the original process worked well for automated upgrade scripts, and not needing to check what the latest version is each time.

@InsaneSplash commented on GitHub (Feb 13, 2025): Pity you need to specify the version, as the original process worked well for automated upgrade scripts, and not needing to check what the latest version is each time.
Author
Owner

@pentiumoverdrive commented on GitHub (Feb 13, 2025):

@pentiumoverdrive @fixed77

Just trying to help: I stopped using the "branch way" of doing upgrades. Following the new way of upgrading:

cd /opt/netbox
sudo git fetch --tags
sudo git checkout v4.2.3 (SELECT THE VERSION YOU NEED/WANT)
sudo PYTHON=/usr/bin/python3.12 /opt/netbox/upgrade.sh
sudo systemctl restart netbox netbox-rq
sudo systemctl status netbox netbox-rq

this is also the official documented upgrade process when using git: https://netboxlabs.com/docs/netbox/en/stable/installation/upgrading/

I upgraded from 4.1.3 to 4.2.1 that way, and have gone through upgrades 4.2.2 and 4.2.3 like this... so far no issues (except for that database issue, but that was not related to the branching stuff)

That didn't work, lots of complaints about changed files (which I hadn't touched)...so I gave up and went for tar.gz way instead...

systemctl stop netbox netbox-rq
cd /opt
mv netbox netbox.old
curl -L -O https://github.com/netbox-community/netbox/archive/refs/tags/v4.2.3.tar.gz
tar zvxf v4.2.3.tar.gz
mv netbox-4.2.3 netbox
chmod 761 /opt/netbox/
cp -a /opt/netbox.old/netbox/netbox/configuration.py /opt/netbox/netbox/netbox/configuration.py
cp -a /opt/netbox/contrib/gunicorn.py /opt/netbox/gunicorn.py
cp -v /opt/netbox/contrib/*.service /etc/systemd/system/
systemctl daemon-reload
chown --recursive netbox /opt/netbox/netbox/media/
chown --recursive netbox /opt/netbox/netbox/reports/
chown --recursive netbox /opt/netbox/netbox/scripts/
chmod 765 /opt/netbox/netbox/static/
chown -R netbox:netbox /opt/netbox/venv/
restorecon -rv /opt/netbox
systemctl start netbox netbox-rq

@pentiumoverdrive commented on GitHub (Feb 13, 2025): > [@pentiumoverdrive](https://github.com/pentiumoverdrive) [@fixed77](https://github.com/fixed77) > > Just trying to help: I stopped using the "branch way" of doing upgrades. Following the new way of upgrading: > > ``` > cd /opt/netbox > sudo git fetch --tags > sudo git checkout v4.2.3 (SELECT THE VERSION YOU NEED/WANT) > sudo PYTHON=/usr/bin/python3.12 /opt/netbox/upgrade.sh > sudo systemctl restart netbox netbox-rq > sudo systemctl status netbox netbox-rq > ``` > > this is also the official documented upgrade process when using git: https://netboxlabs.com/docs/netbox/en/stable/installation/upgrading/ > > I upgraded from 4.1.3 to 4.2.1 that way, and have gone through upgrades 4.2.2 and 4.2.3 like this... so far no issues (except for that database issue, but that was not related to the branching stuff) That didn't work, lots of complaints about changed files (which I hadn't touched)...so I gave up and went for tar.gz way instead... systemctl stop netbox netbox-rq cd /opt mv netbox netbox.old curl -L -O https://github.com/netbox-community/netbox/archive/refs/tags/v4.2.3.tar.gz tar zvxf v4.2.3.tar.gz mv netbox-4.2.3 netbox chmod 761 /opt/netbox/ cp -a /opt/netbox.old/netbox/netbox/configuration.py /opt/netbox/netbox/netbox/configuration.py cp -a /opt/netbox/contrib/gunicorn.py /opt/netbox/gunicorn.py cp -v /opt/netbox/contrib/*.service /etc/systemd/system/ systemctl daemon-reload chown --recursive netbox /opt/netbox/netbox/media/ chown --recursive netbox /opt/netbox/netbox/reports/ chown --recursive netbox /opt/netbox/netbox/scripts/ chmod 765 /opt/netbox/netbox/static/ chown -R netbox:netbox /opt/netbox/venv/ restorecon -rv /opt/netbox systemctl start netbox netbox-rq
Author
Owner

@litebito commented on GitHub (Feb 13, 2025):

Pity you need to specify the version, as the original process worked well for automated upgrade scripts, and not needing to check what the latest version is each time.

you would still be able to use scripts for automated update to the latest release, you just would have to add a few extra lines
for example in a shell script, something like :

$ sudo git fetch --tags
$ VERSION=$(git tag | sort -V | tail -1)
$ echo $VERSION
v4.2.3
$ sudo git checkout $VERSION
@litebito commented on GitHub (Feb 13, 2025): > Pity you need to specify the version, as the original process worked well for automated upgrade scripts, and not needing to check what the latest version is each time. you would still be able to use scripts for automated update to the latest release, you just would have to add a few extra lines for example in a shell script, something like : ``` $ sudo git fetch --tags $ VERSION=$(git tag | sort -V | tail -1) $ echo $VERSION v4.2.3 $ sudo git checkout $VERSION ```
Author
Owner

@litebito commented on GitHub (Feb 13, 2025):

@pentiumoverdrive @fixed77
Just trying to help: I stopped using the "branch way" of doing upgrades. Following the new way of upgrading:

cd /opt/netbox
sudo git fetch --tags
sudo git checkout v4.2.3 (SELECT THE VERSION YOU NEED/WANT)
sudo PYTHON=/usr/bin/python3.12 /opt/netbox/upgrade.sh
sudo systemctl restart netbox netbox-rq
sudo systemctl status netbox netbox-rq

this is also the official documented upgrade process when using git: https://netboxlabs.com/docs/netbox/en/stable/installation/upgrading/
I upgraded from 4.1.3 to 4.2.1 that way, and have gone through upgrades 4.2.2 and 4.2.3 like this... so far no issues (except for that database issue, but that was not related to the branching stuff)

That didn't work, lots of complaints about changed files (which I hadn't touched)...so I gave up and went for tar.gz way instead...

systemctl stop netbox netbox-rq cd /opt mv netbox netbox.old curl -L -O https://github.com/netbox-community/netbox/archive/refs/tags/v4.2.3.tar.gz tar zvxf v4.2.3.tar.gz mv netbox-4.2.3 netbox chmod 761 /opt/netbox/ cp -a /opt/netbox.old/netbox/netbox/configuration.py /opt/netbox/netbox/netbox/configuration.py cp -a /opt/netbox/contrib/gunicorn.py /opt/netbox/gunicorn.py cp -v /opt/netbox/contrib/*.service /etc/systemd/system/ systemctl daemon-reload chown --recursive netbox /opt/netbox/netbox/media/ chown --recursive netbox /opt/netbox/netbox/reports/ chown --recursive netbox /opt/netbox/netbox/scripts/ chmod 765 /opt/netbox/netbox/static/ chown -R netbox:netbox /opt/netbox/venv/ restorecon -rv /opt/netbox systemctl start netbox netbox-rq

I had something similar for some files, I probably did some detail wrong while using git before swtiching, but because I don't make any changes to Netbox code, I tried something like a reset or clear of the local git mirror (I don't remember the exact steps, but rebase didn't really work), after trying

$ sudo git reset --hard origin/master
$ sudo git pull origin master
$ sudo git fetch --tags

It kind of set things free, and allowed me to continue.

(take a backup before trying this !!!)

I think there is a step we have to do to properly get started with the checkout way of doing things, coming from the branch way of doing things.

@litebito commented on GitHub (Feb 13, 2025): > > [@pentiumoverdrive](https://github.com/pentiumoverdrive) [@fixed77](https://github.com/fixed77) > > Just trying to help: I stopped using the "branch way" of doing upgrades. Following the new way of upgrading: > > ``` > > cd /opt/netbox > > sudo git fetch --tags > > sudo git checkout v4.2.3 (SELECT THE VERSION YOU NEED/WANT) > > sudo PYTHON=/usr/bin/python3.12 /opt/netbox/upgrade.sh > > sudo systemctl restart netbox netbox-rq > > sudo systemctl status netbox netbox-rq > > ``` > > > > > > > > > > this is also the official documented upgrade process when using git: https://netboxlabs.com/docs/netbox/en/stable/installation/upgrading/ > > I upgraded from 4.1.3 to 4.2.1 that way, and have gone through upgrades 4.2.2 and 4.2.3 like this... so far no issues (except for that database issue, but that was not related to the branching stuff) > > That didn't work, lots of complaints about changed files (which I hadn't touched)...so I gave up and went for tar.gz way instead... > > systemctl stop netbox netbox-rq cd /opt mv netbox netbox.old curl -L -O https://github.com/netbox-community/netbox/archive/refs/tags/v4.2.3.tar.gz tar zvxf v4.2.3.tar.gz mv netbox-4.2.3 netbox chmod 761 /opt/netbox/ cp -a /opt/netbox.old/netbox/netbox/configuration.py /opt/netbox/netbox/netbox/configuration.py cp -a /opt/netbox/contrib/gunicorn.py /opt/netbox/gunicorn.py cp -v /opt/netbox/contrib/*.service /etc/systemd/system/ systemctl daemon-reload chown --recursive netbox /opt/netbox/netbox/media/ chown --recursive netbox /opt/netbox/netbox/reports/ chown --recursive netbox /opt/netbox/netbox/scripts/ chmod 765 /opt/netbox/netbox/static/ chown -R netbox:netbox /opt/netbox/venv/ restorecon -rv /opt/netbox systemctl start netbox netbox-rq I had something similar for some files, I probably did some detail wrong while using git before swtiching, but because I don't make any changes to Netbox code, I tried something like a reset or clear of the local git mirror (I don't remember the exact steps, but rebase didn't really work), after trying ``` $ sudo git reset --hard origin/master $ sudo git pull origin master $ sudo git fetch --tags ``` It kind of set things free, and allowed me to continue. (take a backup before trying this !!!) I think there is a step we have to do to properly get started with the checkout way of doing things, coming from the branch way of doing things.
Author
Owner

@InsaneSplash commented on GitHub (Feb 13, 2025):

Pity you need to specify the version, as the original process worked well for automated upgrade scripts, and not needing to check what the latest version is each time.

you would still be able to use scripts for automated update to the latest release, you just would have to add a few extra lines for example in a shell script, something like :

$ sudo git fetch --tags
$ VERSION=$(git tag | sort -V | tail -1)
$ echo $VERSION
v4.2.3
$ sudo git checkout $VERSION

Thank You!

@InsaneSplash commented on GitHub (Feb 13, 2025): > > Pity you need to specify the version, as the original process worked well for automated upgrade scripts, and not needing to check what the latest version is each time. > > you would still be able to use scripts for automated update to the latest release, you just would have to add a few extra lines for example in a shell script, something like : > > ``` > $ sudo git fetch --tags > $ VERSION=$(git tag | sort -V | tail -1) > $ echo $VERSION > v4.2.3 > $ sudo git checkout $VERSION > ``` Thank You!
Author
Owner

@github-actions[bot] commented on GitHub (May 15, 2025):

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. NetBox is governed by a small group of core maintainers which means not all opened issues may receive direct feedback. Do not attempt to circumvent this process by "bumping" the issue; doing so will result in its immediate closure and you may be barred from participating in any future discussions. Please see our contributing guide.

@github-actions[bot] commented on GitHub (May 15, 2025): This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. NetBox is governed by a small group of core maintainers which means not all opened issues may receive direct feedback. **Do not** attempt to circumvent this process by "bumping" the issue; doing so will result in its immediate closure and you may be barred from participating in any future discussions. Please see our [contributing guide](https://github.com/netbox-community/netbox/blob/main/CONTRIBUTING.md).
Author
Owner

@github-actions[bot] commented on GitHub (Jun 14, 2025):

This issue has been automatically closed due to lack of activity. In an effort to reduce noise, please do not comment any further. Note that the core maintainers may elect to reopen this issue at a later date if deemed necessary.

@github-actions[bot] commented on GitHub (Jun 14, 2025): This issue has been automatically closed due to lack of activity. In an effort to reduce noise, please do not comment any further. Note that the core maintainers may elect to reopen this issue at a later date if deemed necessary.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#10642