Skip to content

Instantly share code, notes, and snippets.

@grahamperrin
Last active March 18, 2023 17:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save grahamperrin/a034e16a222e0e8f092c0842b944451b to your computer and use it in GitHub Desktop.
Save grahamperrin/a034e16a222e0e8f092c0842b944451b to your computer and use it in GitHub Desktop.

Untangling with Git, 2023-03-18

Prior to https://github.com/freebsd/freebsd-doc/commit/6ea7740b027363bbf5ed106ab414953f5c2da15e.

Context: freebsd/freebsd-doc#134 (comment)

Key point

git -C /usr/doc pull --rebase upstream main

  • upstream is the FreeBSD-provided mirror

and (later) don't forget to:

git -C /usr/doc push --force origin HEAD^:main

  • origin is my fork, in GitHub, of upstream.

Partial transcript

Including some mis-steps:

% git -C /usr/doc pull upstream main
From https://github.com/freebsd/freebsd-doc
 * 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.
% git -C /usr/doc pull --ff-only upstream main
From https://github.com/freebsd/freebsd-doc
 * branch                  main       -> FETCH_HEAD
fatal: Not possible to fast-forward, aborting.
% git -C /usr/doc pull --rebase upstream main
From https://github.com/freebsd/freebsd-doc
 * branch                  main       -> FETCH_HEAD
warning: skipped previously applied commit dd99e1d00e
hint: use --reapply-cherry-picks to include skipped commits
hint: Disable this message with "git config advice.skippedCherryPicks false"
Successfully rebased and updated refs/heads/main.
% git -C /usr/doc log --oneline -2
0f95427a6a (HEAD -> main, upstream/main, freebsd/main) Status call template: earlier (not earliest)
5722bc56a8 Add checksums for 13.2-RC3
% git -C /usr/doc apply -v /tmp/option.diff
Checking patch website/content/en/releases/13.2R/relnotes.adoc...
Applied patch website/content/en/releases/13.2R/relnotes.adoc cleanly.
% git -C /usr/doc add . && git -C /usr/doc commit -a
[main 6ea7740b02] 13.2R notes: reword 'now has a -r option'
 1 file changed, 1 insertion(+), 1 deletion(-)
% git -C /usr/doc push freebsd main
Enter passphrase for key '/home/grahamperrin/.ssh/id_rsa': 
Enumerating objects: 15, done.
Counting objects: 100% (15/15), done.
Delta compression using up to 4 threads
Compressing objects: 100% (8/8), done.
Writing objects: 100% (8/8), 860 bytes | 860.00 KiB/s, done.
Total 8 (delta 7), reused 0 (delta 0), pack-reused 0
To repo.freebsd.org:doc.git
   0f95427a6a..6ea7740b02  main -> main
% 

…

% git -C /usr/doc log --oneline -5
6ea7740b02 (HEAD -> main, upstream/main, freebsd/main) 13.2R notes: reword 'now has a -r option'
0f95427a6a Status call template: earlier (not earliest)
5722bc56a8 Add checksums for 13.2-RC3
6fca32fd5f [phb]: Document the use of Makefile.crates
6d5e8da29b EN template: fix release numbering order
% git -C /usr/doc push --force origin HEAD^:main
Username for 'https://github.com': 
Password for 'https://grahamperrin@github.com': 
Total 0 (delta 0), reused 0 (delta 0), pack-reused 0
To https://github.com/grahamperrin/freebsd-doc.git
 + 62e17d52f2...0f95427a6a HEAD^ -> main (forced update)
% git -C /usr/doc log --oneline -3
6ea7740b02 (HEAD -> main, upstream/main, freebsd/main) 13.2R notes: reword 'now has a -r option'
0f95427a6a (origin/main, origin/HEAD) Status call template: earlier (not earliest)
5722bc56a8 Add checksums for 13.2-RC3
% gh repo sync grahamperrin/freebsd-doc && gh repo sync grahamperrin/freebsd-ports && gh repo sync grahamperrin/freebsd-src
✓ Synced the "grahamperrin:main" branch from "freebsd:main"
✓ Synced the "grahamperrin:main" branch from "freebsd:main"
✓ Synced the "grahamperrin:main" branch from "freebsd:main"
% 
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment