checking out a commits on port quarterly branch

Dan Langille dan at langille.org
Wed Nov 18 22:31:00 UTC 2020


When FreshPorts processes a commit, it needs a working copy of the repo as it was at the time of that commit.

I have this working on head. I am trying to figure out how to do that when the commit is on a branch.

To get a copy of the branch, I do:

$ git checkout branches/2020Q4
$ git branch
  branches/2020Q2
  branches/2020Q3
* branches/2020Q4
  master

Next, I want the tree as it existed at commit 46433baae934d92698422495b72f811839caa1a9

i.e. https://github.com/freebsd/freebsd-ports/commit/46433baae934d92698422495b72f811839caa1a9

My first attempt is

$ git checkout 46433baae934d92698422495b72f811839caa1a9
Note: switching to '46433baae934d92698422495b72f811839caa1a9'.

You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by switching back to a branch.

If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -c with the switch command. Example:

  git switch -c <new-branch-name>

Or undo this operation with:

  git switch -

Turn off this advice by setting config variable advice.detachedHead to false

HEAD is now at 46433baae934 MFH: r555565

That "MFH: r555565' message indicates that I am at the right commit.

Is this a concern?

$ git branch
* (HEAD detached at 46433baae934)
  branches/2020Q2
  branches/2020Q3
  branches/2020Q4
  master


Am I doing this right?

Thank you


-- 
Dan Langille - BSDCan / PGCon
dan at langille.org




More information about the freebsd-git mailing list