* Using Git as a Database
@ 2024-09-23 3:28 Mateusz Wielgos
2024-09-23 3:48 ` [External] " 韩仰
2024-09-25 16:47 ` Sergey Organov
0 siblings, 2 replies; 6+ messages in thread
From: Mateusz Wielgos @ 2024-09-23 3:28 UTC (permalink / raw)
To: git
Hello,
I would like to use Git as a database of sorts. Let’s say I want to track weight of something in a file. When the value changes I can commit the new one. I can also figure out all previous values. That’s awesome.
What I am having trouble with is… What if a measurement is taken but there’s no change? I want to commit a file that hasn’t changed.
The only workaround I figured out is to toggle the executable bit.
Is there anything else?
Thanks,
Mateusz
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [External] Using Git as a Database
2024-09-23 3:28 Using Git as a Database Mateusz Wielgos
@ 2024-09-23 3:48 ` 韩仰
2024-09-23 12:32 ` email
2024-09-25 16:47 ` Sergey Organov
1 sibling, 1 reply; 6+ messages in thread
From: 韩仰 @ 2024-09-23 3:48 UTC (permalink / raw)
To: Mateusz Wielgos; +Cc: git
You can use the --allow-empty option in git-commit to allow
such commits.
Thanks,
Han
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [External] Using Git as a Database
2024-09-23 3:48 ` [External] " 韩仰
@ 2024-09-23 12:32 ` email
2024-09-23 18:42 ` Andreas Schwab
0 siblings, 1 reply; 6+ messages in thread
From: email @ 2024-09-23 12:32 UTC (permalink / raw)
To: 韩仰; +Cc: git
Thank you for your reply, Han. The problem that I have with ‘—allow-empty’ is that the resulting commit is not associated with any particular file. I tried ‘git commit —allow-empty myfile.txt’ but the file argument is effectively ignored. ‘git log myfile.txt’ does not show the empty commit.
> On Sep 22, 2024, at 10:48 PM, 韩仰 <hanyang.tony@bytedance.com> wrote:
>
> You can use the --allow-empty option in git-commit to allow
> such commits.
>
> Thanks,
> Han
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [External] Using Git as a Database
2024-09-23 12:32 ` email
@ 2024-09-23 18:42 ` Andreas Schwab
2024-09-23 19:09 ` rsbecker
0 siblings, 1 reply; 6+ messages in thread
From: Andreas Schwab @ 2024-09-23 18:42 UTC (permalink / raw)
To: email; +Cc: 韩仰, git
On Sep 23 2024, email@mateuszwielgos.com wrote:
> Thank you for your reply, Han. The problem that I have with ‘—allow-empty’ is that the resulting commit is not associated with any particular file. I tried ‘git commit —allow-empty myfile.txt’ but the file argument is effectively ignored. ‘git log myfile.txt’ does not show the empty commit.
Since the git model is snapshot based, there is no way around that,
apart from putting the reference in the commit message which you can
search with git log --grep=myfile.txt.
--
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510 2552 DF73 E780 A9DA AEC1
"And now for something completely different."
^ permalink raw reply [flat|nested] 6+ messages in thread
* RE: [External] Using Git as a Database
2024-09-23 18:42 ` Andreas Schwab
@ 2024-09-23 19:09 ` rsbecker
0 siblings, 0 replies; 6+ messages in thread
From: rsbecker @ 2024-09-23 19:09 UTC (permalink / raw)
To: 'Andreas Schwab', email; +Cc: '韩仰', git
On September 23, 2024 2:43 PM, Andreas Schwab wrote:
>On Sep 23 2024, email@mateuszwielgos.com wrote:
>
>> Thank you for your reply, Han. The problem that I have with ‘—allow-empty’ is
>that the resulting commit is not associated with any particular file. I tried ‘git commit
>—allow-empty myfile.txt’ but the file argument is effectively ignored. ‘git log
>myfile.txt’ does not show the empty commit.
>
>Since the git model is snapshot based, there is no way around that, apart from
>putting the reference in the commit message which you can search with git log --
>grep=myfile.txt.
One way around this is to inject a date/timestamp in the file. Be careful about conflicts
If you every try to merge. This forces a signature change in the internal blob on
commit.
I am not recommending this, just suggesting a way to force the issue.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Using Git as a Database
2024-09-23 3:28 Using Git as a Database Mateusz Wielgos
2024-09-23 3:48 ` [External] " 韩仰
@ 2024-09-25 16:47 ` Sergey Organov
1 sibling, 0 replies; 6+ messages in thread
From: Sergey Organov @ 2024-09-25 16:47 UTC (permalink / raw)
To: Mateusz Wielgos; +Cc: git
Mateusz Wielgos <email@mateuszwielgos.com> writes:
> Hello,
>
> I would like to use Git as a database of sorts. Let’s say I want to
> track weight of something in a file. When the value changes I can
> commit the new one. I can also figure out all previous values. That’s
> awesome.
>
> What I am having trouble with is… What if a measurement is taken but
> there’s no change? I want to commit a file that hasn’t changed.
>
> The only workaround I figured out is to toggle the executable bit.
As you are tracking weight or something like that over time, it's likely
useless without date, so just put time-stamp into the file as well:
85kg 2024-09-25 19:45:14
-- Sergey
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2024-09-25 16:47 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-09-23 3:28 Using Git as a Database Mateusz Wielgos
2024-09-23 3:48 ` [External] " 韩仰
2024-09-23 12:32 ` email
2024-09-23 18:42 ` Andreas Schwab
2024-09-23 19:09 ` rsbecker
2024-09-25 16:47 ` Sergey Organov
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).