freebsd-git-docs icon indicating copy to clipboard operation
freebsd-git-docs copied to clipboard

Extracting the original FreeBSD branch name when using a local branch?

Open Ximalas opened this issue 4 years ago • 2 comments

I use a local branch to keep track of my own stuff, kernel configuration files and one firstboot script.

When I ask Git which branch is checked out, I get the name of my own branch, local. Is there a Git command for extracting the name of the branch of which the local branch was rebased on?

The name of local branch will also be part of the kernel's identification. What are the pros and cons of naming a local branch as main+local or stable/13+local? All forward slashes and plus signs must be changed to, say, dashes when used as part of ZFS filesystem and snapshot names.

When stable/14 comes to light, I imagine this sequence:

cd /usr/src
# Already on the stable/13+local branch.
git checkout -b stable/14+local
# It's not a given that stable/14 is known to the local repo.
# And it's not a given that I know what I'm talking about.
git checkout stable/13
git pull --no-edit --no-ff
git checkout stable/14
git rebase stable/14 stable/14+local
# Fixup any files.
git add ...
git commit

Any later update proceeds as usual:

cd /usr/src
git checkout stable/14
git pull --no-edit --no-ff
git rebase stable/14 stable/14+local

Ximalas avatar Feb 10 '21 13:02 Ximalas

Last evening I had to run some additional commands on my laptop running main, and then repeat the update procedure:

git -C /usr/src prune
git -C /usr/src gc --auto

Ximalas avatar Feb 11 '21 07:02 Ximalas

The general problem is a hard.

However, you can make an educated guess with rev-count:

% git rev-list main.. --first-parent --count
3
% git rev-list stable/13.. --first-parent --count
407
% git rev-list stable/12.. --first-parent --count
18716

This is for a branch off main...

bsdimp avatar Feb 11 '21 16:02 bsdimp