Git

!git

@programming.dev
Create post
Learn Git Branching

Learn Git Branching

Open link in next tab

Learn Git Branching

https://learngitbranching.js.org/

An interactive Git visualization tool to educate and challenge!

Learn Git Branching
Radicle 1.0 released

Radicle 1.0 released

Open link in next tab

Radicle

https://radicle.xyz/2024/09/10/radicle-1.0.html

Sovereign code infrastructure.

Radicle
Git bisect run techniques

Git bisect run techniques

Open link in next tab

Git bisect run techniques

https://paperless.blog/git-bisect-run-techniques

git bisect run lets us find the breaking commit in O(log(N)) time for N commits, by doing a binary search through commits to determine the one which broke things. It is extremely useful, but the thing which often takes a long time is figuring out which command to use to reliably determine whether a commit is good or bad. This article explains some techniques to help with this task.

Creating a Git commit: The Hard Way

Creating a Git commit: The Hard Way

Open link in next tab

Creating a Git commit: The Hard Way

https://avestura.dev/blog/creating-a-git-commit-the-hard-way

Let's create a Git commit using Git's low-level (plumbing) commands

Creating a Git commit: The Hard Way
Git: avoid reset --hard, use reset --keep instead

Git: avoid reset --hard, use reset --keep instead

Open link in next tab

Git: avoid reset --hard, use reset --keep instead - Adam Johnson

https://adamj.eu/tech/2024/09/02/git-avoid-reset-hard-use-keep/

When I started learning Git, I found many references covering two ways to undo commits with git reset:

Git: avoid reset --hard, use reset --keep instead - Adam Johnson
Git Rev News Edition 114 (August 31st, 2024)

Git Rev News Edition 114 (August 31st, 2024)

Open link in next tab

Git Rev News Edition 114 (August 31st, 2024)

https://git.github.io/rev_news/2024/08/31/edition-114/

PSA: Git exposes timezone metadata

PSA: Git exposes timezone metadata

Git records the local timezone when a commit is made [1]. Knowledge of the timezone in which a commit was made could be used as a bit of identifying information to de-anonymize the committer.

Setting one's timezone to UTC can help mitigate this issue [2][3] (though, ofc, one must still be wary of time-of-day commit patterns being used to deduce a timezone).

::: spoiler References

  1. Git documentation. git-commit. "Date Formats: Git internal format". Accessed: 2024-08-31T07:52Z. https://git-scm.com/docs/git-commit#Documentation/git-commit.txt-Gitinternalformat.

    It is <unix-timestamp> <time-zone-offset>, where <unix-timestamp> is the number of seconds since the UNIX epoch. <time-zone-offset> is a positive or negative offset from UTC. For example CET (which is 1 hour ahead of UTC) is +0100.

  2. jthill. "How can I ignore committing timezone information in my commit?". Stack Overflow. Published: 2014-05-26T16:57:37Z. (Accessed: 2024-08-31T08:27Z). https://stackoverflow.com/questions/23874208/how-can-i-ignore-committing-timezone-information-in-my-commit#comment36750060_23874208.

    to set the timezone for a specific command, say e.g. TZ=UTC git commit

  3. Oliver. "How can I ignore committing timezone information in my commit?". Stack Overflow. Published: 2022-05-22T08:56:38Z (Accessed: 2024-08-31T08:30Z). https://stackoverflow.com/a/72336094/7934600

    each commit Git stores a author date and a commit date. So you have to omit the timezone for both dates.

    I solved this for my self with the help of the following Git alias:

    [alias]
    co = "!f() { \
        export GIT_AUTHOR_DATE=\"$(date -u +%Y-%m-%dT%H:%M:%S%z)\"; \
        export GIT_COMMITTER_DATE=\"$(date -u +%Y-%m-%dT%H:%M:%S%z)\"; \
        git commit $@; \
        git log -n 1 --pretty=\"Autor: %an <%ae> (%ai)\"; \
        git log -n 1 --pretty=\"Committer: %cn <%ce> (%ci)\"; \
    }; f"
    

:::


Cross-posts:

git-random: build random content git trees for training purposes

git-random: build random content git trees for training purposes

Open link in next tab

git-random

https://git-random.olets.dev/

An aid for learning and experimenting with Git.

git-random
Store Code Discussions in Git using Git Notes

Store Code Discussions in Git using Git Notes

Open link in next tab

Store Code Discussions in Git using Git Notes

https://wouterj.nl/2024/08/git-notes

Code discussions contain relevant information. Isn’t it a shame that we keep these in the centralized GitHub/GitLab servers, far away from our decentralized Git code? As soon as we move provider, we’ll lose all old discussions! And how do you ever find the pull requests back from 5 years ago? Symfony has implemented a lightweight solution to this problem years ago using a less-known feature of Git: Git Notes.

Store Code Discussions in Git using Git Notes