Last active
March 5, 2025 13:49
-
-
Save EBNull/ef5777307cfc375582e30192599f5fef to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[remote "origin"] | |
url = [email protected]:DataDog/dd-source.git | |
#fetch = +refs/heads/*:refs/remotes/origin/* | |
fetch = +refs/heads/ebnull/*:refs/remotes/origin/ebnull/* | |
fetch = +refs/heads/spr/ebnull/*:refs/remotes/origin/spr/ebnull/* | |
fetch = +refs/heads/main:refs/remotes/origin/main | |
#fetch = +refs/heads/wip:refs/remotes/origin/wip | |
tagOpt = --no-tags | |
[branch "main"] | |
remote = origin | |
merge = refs/heads/main | |
[branch "wip"] | |
remote = origin | |
merge = refs/heads/wip |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
git.push-bookmark-prefix = "ebnull/jj/push-" | |
git.private-commits = "description(glob-i:'wip:*') | description(glob-i:'private:*')" | |
[revset-aliases] | |
# See https://github.com/martinvonz/jj/blob/main/cli/src/config/revsets.toml | |
hidden = "description(glob-i:'hide:*')" | |
log = '(present(@) | ancestors(immutable_heads().., 2) | trunk()) | ~hidden())' | |
[user] | |
name = "Elise Burke" | |
email = "[email protected]" | |
[ui] | |
default-command = "log" | |
[snapshot] | |
auto-track = "none()" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -eu | |
# Ideally we could use this - "Every commit that is the root of the descendants of trunk" | |
#REVS='roots(trunk():: ~ immutable_heads())' | |
# But we can't because by the time we rebase, trunk has moved. | |
# So we need to approximate the old trunk: | |
# Every commit that (is the root of the set of commits that (is not an ancestor of trunk except for ancestors of immutable heads (excluding trunk))) | |
REVS='roots(~ancestors(trunk()) & ~ancestors(immutable_heads() & ~trunk()))' | |
DEST='trunk()' | |
branches_to_delete() { | |
# Return all branches that point to immutable heads, except for the main one. | |
# Branches may have changed on the remote (e.g. deleted), so remove the asterisk marker. | |
# | |
# Note that the template accounts for revisions with multiple branches (via join()) and multiple revisions (via appending a newline) | |
jj log --no-graph -T 'local_bookmarks.join("\n") ++ "\n"' -r 'immutable_heads()' | grep -v -E '^(main|master|trunk)$' | sed 's/*$//' | |
} | |
x() { | |
( | |
set -x | |
"$@" | |
) | |
} | |
preview() { | |
echo "Will rebase:" | |
echo | |
jj --no-pager log -r "$REVS" | |
echo -e "\nonto:\n" | |
jj --no-pager log -r "$DEST" | |
echo | |
echo "Will delete:" | |
branches_to_delete | |
} | |
go() { | |
x jj rebase --skip-emptied -s "all:$REVS" -d "$DEST" | |
x branches_to_delete | x xargs -r jj bookmark delete | |
} | |
while (($#)); do | |
case "$1" in | |
"go" | "preview") | |
$1 | |
exit $? | |
;; | |
"-f") | |
git fetch | |
;; | |
"--pull") | |
git fetch | |
;; | |
*) | |
echo "unknown command or arg" | |
exit 2 | |
;; | |
esac | |
shift | |
done | |
go --pull |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment