Solved how to install ports with git

Hi! , so time ago I was using ports-mgmt/portsnap but is deprecated (before bsd 14.1)

correct me if I'm wrong, the command is this :

git clone https://git.freebsd.org/ports.git /usr/ports

I admit that I ever use Git , so , my 2 questions

-Now I'm in 14.1-RELEASE , but I had to indicate with release I want to download or is automatic?
For example, not download the 14.0 ports
-How update the ports?

Thanks in advance
 
If you want to pull/clone faster, you can use --depth=1.

If you want to pull latest ports tree, you can pull main branch. If you want to pull quarterly branch, you can pull for example 2024Q2 branch.
Code:
# latest
git clone --depth=1 -b main https://git.freebsd.org/ports.git /usr/ports
# quarterly
git clone --depth=1 -b 2024Q2 https://git.freebsd.org/ports.git /usr/ports
To update the ports, you can pull updates using git pull.

Code:
# latest
git pull origin main
# quarterly
git pull origin 2024Q2
 
Now I'm in 14.1-RELEASE , but I had to indicate with release I want to download or is automatic?
There is only one ports tree. There are only two branches of interest, main is where everything happens, all the time, there's a continues stream of updates getting pushed to main. From main the latest packages are built. The other interesting branches are named 2024Q1, 2024Q2, etc., those are the quarterly branches, the quarterly packages are built from the <year>Q<#quarter> branches. The ports tree is not depended on the version or architecture of the OS. Specific ports may have such a dependency (graphics/drm-61-kmod for example needs 14.1+) but everything is still in one and the same ports tree.

-How update the ports?
cd /usr/ports ; git pull -p
 
Ok, I'm trying to do things in a simple way. If I want the main branch and always update that one, the following commands are right?

First time to get the (main branch) ports tree (equal to command portsnap fetch extract)
Code:
mkdir -p /usr/ports
git clone https://git.freebsd.org/ports.git /usr/ports

Updating the (main branch) ports tree (equal to command portsnap fetch update)
Code:
git pull https://git.freebsd.org/ports.git /usr/ports

or is better the command as sirdice shown?

Code:
cd /usr/ports ; git pull -p

P.S. I never used git, sorry
 
Yesterday I updated the ports via portsnap. Today I installed git and this is what happened.

root@none:/usr/ports # git pull -p

Code:
There is no tracking information for the current branch.
Please specify which branch you want to merge with.
See git-pull(1) for details.
    git pull <remote> <branch>
If you wish to set tracking information for this branch you can do so with:
    git branch --set-upstream-to=<remote>/<branch> master

root@none:/usr/ports # git init
Bash:
hint: Using 'master' as the name for the initial branch. This default branch name
hint: is subject to change. To configure the initial branch name to use in all
hint: of your new repositories, which will suppress this warning, call:
hint:
hint:     git config --global init.defaultBranch <name>
hint:
hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and
hint: 'development'. The just-created branch can be renamed via this command:
hint:
hint:     git branch -m <name>
Initialized empty Git repository in /usr/ports/.git/
root@none:/usr/ports # git clone https://freebsd.org/ports.git /usr/ports/
Code:
fatal: destination path '/usr/ports' already exists and is not an empty directory.
Else...
root@none:/usr/ports # git init
Code:
Reinitialized existing Git repository in /usr/ports/.git/
root@none:/usr/ports # git status
Rich (BB code):
On branch master No commits yet Untracked files: (use "git add <file>..." to include in what will be committed) .arcconfig .gitignore .hooks/ .mailmap .portsnap.INDEX CHANGES CONTRIBUTING.md COPYRIGHT GIDs Keywords/ MOVED Makefile Mk/ README Templates/ Tools/ UIDs UPDATING accessibility/ arabic/ archivers/ astro/ audio/ benchmarks/ biology/ cad/ chinese/ comms/ converters/ databases/ deskutils/ devel/ dns/ editors/ emulators/ finance/ french/ ftp/ games/ german/ graphics/ hebrew/ hungarian/ irc/ japanese/ java/ korean/ lang/ mail/ math/ misc/ multimedia/ net-im/ net-mgmt/ net-p2p/ net/ news/ polish/ ports-mgmt/ portuguese/ print/ russian/ science/ security/ shells/ sysutils/ textproc/ ukrainian/ vietnamese/ www/ x11-clocks/ x11-drivers/ x11-fm/ x11-fonts/ x11-servers/ x11-themes/ x11-toolkits/ x11-wm/ x11/ nothing added to commit but untracked files present (use "git add" to track)"
 
Code:
#!/usr/local/bin/zsh -v
rm -r /usr/ports/* /usr/ports/.??*
cd /usr/ports/
rmdir /usr/ports/distfiles
rmdir /usr/ports/packages
git clone --branch 2024Q3 https://git.FreeBSD.org/ports.git /usr/ports
mkdir /usr/ports/distfiles
mkdir /usr/ports/packages
 

Alain De Vos, thanks a lot!​

root@none:/usr/ports # git status
Code:
On branch 2024Q3
Your branch is up to date with 'origin/2024Q3'.
It took 16.00 seconds to enumerate untracked files.
See 'git help status' for information on how to improve this.
nothing to commit, working tree clean
 
Back
Top