Live data from Hacker News

Git-fetch-file – Sync files from other repos with commit tracking and safety

github.com

11–20 of 20 posts

Re: Git-fetch-file – Sync files from other repos with commit tracking and safety

#12
I was just thinking about this topic this morning, so quite timely post! I received a PR with binary test data files that were copied from an upstream ecosystem. Similarly, I had copied files from that repo, but who should trust me?

Submodules seemed too heavyweight, so I was contemplating a CI script that compared selected checksums with a clone. This seems like a great general solution so will take a look at dropping it in!

Re: Git-fetch-file – Sync files from other repos with commit tracking and safety

#13

Earlier quoted context omitted.

for --dry-run that looks pretty good yeps! I like the "--force hint" in there too! for the "push", I think my idea was mostly about "local-remotes", think "I have both cloned locally, with both IDEs open going back&forth" one injection there would be `../someupstream/file` vs. `../someupstream/.git/refs/HEAD:file`... aka "pick the file as is" (potentially marked as "${HEAD}-dirty" vs. "only committed things are truth…

Good ideas. You mentioning your locally cloned repo was what spurred this. I wanted to do something a little more robust than just copy and paste the file from the other repository, but I also didn't want to inject the entire project as a dependency for a single file. It feels like it would be excessive to perform a remote call if we already have the repository locally checked out, so I'll think that one over. I woul…

I´m mostly thinking in a "tell fetch-file that github.com/mine/scripts.git is already cloned to ~/devstuff/scripts/ fashion" - to then "skip the clone and use my provided folder instead of cloning into CACHE_DIR"

what shines combined with a push-subcommand when doing "active development" in the downstream repo - since it can shove the fix you made back into the upstream so you can commit and release it there

("push" may then also have a --with-commit option that 1) makes a commit in the local upstream 2) updates downstreams `.git-remote-files` commit-key)

on --no-commit idk... while i very much like the idea of it being able to auto-commit, default-enabled might be a little overreaching but not 100% certain on this... - maybe your `--commit ` could become `--ref ` instead to free up --(no-)commit? (ref might even be more git-nomenclature correct ;))

readme: no thanks, just on a throwaway anyhow ;)

Re: Git-fetch-file – Sync files from other repos with commit tracking and safety

#14

I was just thinking about this topic this morning, so quite timely post! I received a PR with binary test data files that were copied from an upstream ecosystem. Similarly, I had copied files from that repo, but who should trust me? Submodules seemed too heavyweight, so I was contemplating a CI script that compared selected checksums with a clone. This seems like a great general solution so will take a look at droppi…

Thank you!

Re: Git-fetch-file – Sync files from other repos with commit tracking and safety

#16

Earlier quoted context omitted.

Good ideas. You mentioning your locally cloned repo was what spurred this. I wanted to do something a little more robust than just copy and paste the file from the other repository, but I also didn't want to inject the entire project as a dependency for a single file. It feels like it would be excessive to perform a remote call if we already have the repository locally checked out, so I'll think that one over. I woul…

I´m mostly thinking in a "tell fetch-file that github.com/mine/scripts.git is already cloned to ~/devstuff/scripts/ fashion" - to then "skip the clone and use my provided folder instead of cloning into CACHE_DIR" what shines combined with a push-subcommand when doing "active development" in the downstream repo - since it can shove the fix you made back into the upstream so you can commit and release it there ("push"…

Yeah, I wasn't sure about the commit flag either! I opted to add the feature using a `--commit` flag with no arguments, and the default remaining to not commit, much like `fetch` itself.

Then, I made the automatic commit messages reflect a style that looked like git's standard automatic commit messages, with summaries for larger commits. Though upon reflection, maybe a list of file changes or updates would be more in-line with git's style.

Maybe that's close enough.

Re: Git-fetch-file – Sync files from other repos with commit tracking and safety

#18
post #17

Seems a very good feature to be able to track branch. Git submodules can only track commits IDs it’s not practical. This could replace git submodules and make it better !

I will test the current functionality and make sure branch tracking works!

Edit: Branch tracking is now supported directly.

Re: Git-fetch-file – Sync files from other repos with commit tracking and safety

#19
Thanks for all the great feedback so far, guys. I've also added some examples for tracking entire repositories by branch, and an example of how to add those directories to your `.gitignore` in case you don't want all their files pull in, but want to `git fetch-fill pull` after cloning.

Re: Git-fetch-file – Sync files from other repos with commit tracking and safety

#20
post #17

Seems a very good feature to be able to track branch. Git submodules can only track commits IDs it’s not practical. This could replace git submodules and make it better !

I will test the current functionality and make sure branch tracking works! Edit: Branch tracking is now supported directly.

Thank you !
Post reply on HN