Skip to content

Instantly share code, notes, and snippets.

View dgroomes's full-sized avatar

David Groomes dgroomes

View GitHub Profile
@dgroomes
dgroomes / splitting-out-a-git-repo-from-a-git-repo.md
Last active September 8, 2020 04:26
Splitting out a Git repo from a Git repo

Splitting out a Git repo from a Git repo

Git ships with an advanced command called filter-branch which can be used to, among other things, split out a new Git repo from a larger Git repo. Unfortunately, the tool has issues and is officially not recommend by Git. They recommend https://github.com/newren/git-filter-repo as an alternative. git-filter-repo seems like it is worth exploring for use cases beyond the most basic happy path. Fortunately, I have only needed the basic happy path of "split out this sub-directory and all its commit history exactly as is into its own Git repo". For a good illustration of this use case, see https://docs.github.com/en/github/using-git/splitting-a-subfolder-out-into-a-new-repository.

The core command is:

git filter-branch --prune-empty --subdirectory-filter FOLDER-NAME  BRANCH-NAME
@dgroomes
dgroomes / build-openjdk-on-macos.md
Last active March 21, 2024 04:54
Build OpenJDK from source on macOS
@dgroomes
dgroomes / upgrade-gradle-wrapper.md
Last active April 6, 2022 02:11
Upgrade Gradle Wrapper

Upgrade Gradle Wrapper

Execute the following command in a Gradle project to upgrade the Gradle Wrapper to the specified version:

./gradlew wrapper --gradle-version 7.4.2

Reference

@dgroomes
dgroomes / download-maven-dependencies-using-gradle.md
Last active December 19, 2020 21:44
Download Maven dependencies using Gradle

Download Maven dependencies using Gradle

Download a Gradle project's Maven dependencies into a directory. For example, you might find this technique useful for very small and simple projects where you want to commit the .jar files directly into Git. This technique was taken from this StackOverflow answer.


Define a downloadDependencies Gradle task, that when executed, will put all of the project's dependencies into a directory named lib/.

task downloadDependencies(type: Copy) {