Skip to content

Add files/folders to a specific commit in history (initial or second commit) #503

Answered by newren
tbnorris asked this question in Q&A
Discussion options

You must be logged in to vote

A few issues here:

  1. git hash-object will treat the argument to it as a file unless you pass the -t option. And if you pass the -t option with tree, you need to file represent a tree object, not an actual directory.
  2. fast-import (which filter-repo uses to write the new history) doesn't accept trees/directories as inputs, meaning you cannot use them and instead have to list all the individual files. If the only file is .github/CODEOWNERS, you'd need to change your command to add that file. If you have multiple files within your .github directory, you'll need to have multiple calls to commit.file_changes.append, one for each file.
  3. It looks like you had your $RELATIVE_TO_PROJECT_ROOT_PATHNAME …

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@tbnorris
Comment options

Answer selected by tbnorris
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants