Skip to content

Commit 7cf5918

Browse files
authored
dev: BI-0 squash commits task (#1252)
dev: BI-0 squash commits task
1 parent f510459 commit 7cf5918

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

Taskfile.dist.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ includes:
4242
{{.ROOT_DIR}}/metapkg
4343
{{.ROOT_DIR}}/terrarium/dl_repmanager/dl_repmanager_tests/testrepo/lib/testing_pkg_boilerplate
4444
{{.ROOT_DIR}}/terrarium/bi_ci/bi_ci_tests/unit/resources
45+
PARENT_BRANCH: '{{.PARENT_BRANCH | default "main"}}'
4546

4647
ops:
4748
taskfile: tools/taskfiles/taskfile_ops.yml

tools/taskfiles/taskfile_dev.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -403,3 +403,18 @@ tasks:
403403
- echo "Next processes will be killed:"
404404
- ps -ef | grep "ssh -f -N -L" | grep --invert-match "grep"
405405
- pkill -f "ssh -f -N -L"
406+
407+
squash:
408+
desc: Squash all commits made on CHILD_BRANCH relative to PARENT_BRANCH into single one (using git reset --soft)
409+
vars:
410+
REMOTE: '{{.REMOTE | default "origin"}}'
411+
requires:
412+
vars:
413+
- PARENT_BRANCH
414+
- CHILD_BRANCH
415+
cmds:
416+
- git fetch {{.REMOTE}} -f {{.PARENT_BRANCH}}:{{.PARENT_BRANCH}}
417+
- git switch {{.CHILD_BRANCH}}
418+
- git fetch {{.REMOTE}} {{.CHILD_BRANCH}}
419+
- git reset --soft $(git merge-base {{.PARENT_BRANCH}} HEAD)
420+
- echo 'Now you can commit merged changes with "git commit -m "commit message"'

0 commit comments

Comments
 (0)