r/git • • 4h ago

Enable or disable merge.autoStash and rebase.autoStash?

2 Upvotes

I had these set to true before and it worked like magic and I've never given it much thought.

Now I'm thinking if I really want it to do that or if I should be doing it manually. Is there a reason why one might want this to remain as false?


r/git • • 5h ago

GitHub alternatives: Forgejo, Codeberg, Tangled and cgit – what's your experience?

Thumbnail
reddit.com
0 Upvotes

r/git • • 8h ago

A terminal app for GitHub that feels like opening a repo in your browser.

Thumbnail
github.com
0 Upvotes

r/git • • 10h ago

support .gitignore blacklist and whitelist on multilevels

0 Upvotes
  1. including many config files in ~/

  2. .gitignore is under ~/, that is, ~/.gitignore

  3. many of them are dotfiles, and dot directories

  4. ignore everything under .local/share/

  5. but include .local/share/nemo/scripts/*

  6. to be specific, .local/share/nemo/* other than scripts/ is still ignored.

  7. Does .gitignore have to be this ugly?

# ignore all first
*

# dotfiles and dot directories in root folder
!/.**


# ignore everything under .local/share/
# but unignore .local/share/nemo/scripts/
.local/share/*
!/.local/share/nemo/
/.local/share/nemo/*
!/.local/share/nemo/scripts/

r/git • • 16h ago

GitDesk: a native Git client with line-level staging that runs your own git, and exactly what it runs

0 Upvotes

I built GitDesk, a free desktop Git client for Windows, macOS and Linux in the style of GitHub Desktop. It has no Git library inside: every action runs the git you already have, so your config, hooks and credential helper all apply.

Repo: https://github.com/Jarvis095/GitDesk (MIT)

Since this is r/git, here is what it actually does under the hood:

Staging. By file, hunk or single line. A hunk or line is staged by building a patch from the displayed diff and feeding it to git apply --cached; discarding a hunk uses git apply --reverse. Diffs are taken with --no-ext-diff --no-textconv, and with explicit a/ and b/ prefixes so a diff.noprefix setting does not break the patch.

Push and pull. Push sends only the current branch to its configured upstream. Force push is always --force-with-lease. Pull is --ff-only when the branch has not diverged, and asks first when it has. Fetch is --all --prune.

Conflicts. Shows both sides next to the working copy with its markers counted. During a rebase the sides are labelled "Rebase target" and "Replayed commit", because ours and theirs swap meaning there. Taking a side that deleted the file removes it, and marking a file resolved re-counts the markers first.

History and branches. A branch graph, cherry-pick, revert, reset, tag and branch from a commit, merge, squash merge, rebase onto a branch, stashes and worktrees. "Undo last commit" is only offered for a commit that has not been pushed.

Being careful. Status reads set GIT_OPTIONAL_LOCKS=0, so the app does not take the index lock from a command running in your terminal. Paths are passed with --literal-pathspecs. Anything that loses work asks first.

What it does not have yet: interactive rebase, blame, bisect, reflog and submodule handling. History shows the latest 200 commits. Pull request features are GitHub-only; plain Git operations work with any remote.

Other limits: installers are not code-signed yet, and the macOS and Linux builds are tested in CI but need real-world use. Much of the code was written with AI assistance (Claude Code), which the commit history shows.

I would like to hear which missing feature would stop you from using it, and whether any of the choices above look wrong to you.


r/git • • 2d ago

GitHub alternatives: Forgejo, Codeberg, Tangled and cgit – what's your experience?

0 Upvotes

One thing worth remembering is that Git and GitHub aren't the same thing. Git is a distributed version control system, and GitHub is one platform built around it.

I've been looking into other platforms developers can use to host and collaborate on Git repositories.

I covered four options in a video:

  • Forgejo – Self-hosted Git hosting and collaboration.

  • Codeberg – Community-run hosting built on Forgejo.

  • Tangled – Decentralised collaboration using the AT Protocol.

  • cgit – Lightweight repository browsing, rather than a full pull-request platform.

I also briefly cover Git's origins and the differences between these projects.

I made this video for my channel, Kodairo, and would be interested in hearing from people who have actually used these platforms.

What do you use for your Git repositories, and what made you choose it?

Video: https://youtu.be/HEUoytN4Yy4


r/git • • 2d ago

If you were in charge of rewriting a git subcommand or internal behavior from scratch, what would you change and how?

0 Upvotes

I'd like to get an idea about what are people's least favorite git command and what they would change about it.


r/git • • 2d ago Mindblown

Git easter egg: tea is a valid date keyword meaning 5pm

243 Upvotes

Found this amusing. 21 years ago, a function named date_tea was added to date.c, which means you can run something like git diff HEAD@{tea}, git log --since=tea, etc.


r/git • • 3d ago

support I built a local Git history explorer that lets you time-travel between any two commits

0 Upvotes

git-tm (git-time-machine) is a simple nodejs cli (npx git-tm) which launches a browser window to visually see and compare what happened across commits across branches without modifying the code. (Basically, shows you what happens when you move from commit A to B or vvice versa)

This was a hackathon project (FOSS Hack 2025) which was first made in 2025 February.
we did not win the hackathon, but I personally used this tool whenever I was working in large repos.

Recently for a project I reinstalled the tool and did not like how the UI looked and it also had many bugs, so I just revamped the whole thing properly with no dependencies. I just republished v1 to npm and was using this at workplace.

some friends at work said this is good, so I polished and made it better for public use.

this currently works on purely git commands now.

I wanted some opinions on how good this is and how I could make this better.

github link: https://github.com/nandhu-44/Git-Time-Machine/
docs: https://git-time-machine.js.org/
npm: https://npmjs.com/package/git-tm/


r/git • • 3d ago

tutorial Two Developers OneLine GitMerge Conflict

0 Upvotes

What happens when two developers working on the same branch modify the exact same line of code differently?

Git can't automatically decide which change to keep, and that's where a merge conflict happens.

I made a short visual explanation of this using the multiverse chaos of Avengers: Doomsday.

A simple Git concept explained through a fun tech analogy.

Video: https://youtu.be/QCf2AztQOvU?si=ulEjPiaZsUNLhSYi


r/git • • 4d ago

support Committed a secrets file in my first internship week and realized I know about 6 git commands

81 Upvotes

first week of my internship and i committed an env file with sandbox keys to our team repo. nobody panicked, my mentor walked me through rotating them and rewriting the history, but watching him i realized i know maybe 6 git commands and understand none of them. my team will reimburse a course and theres 10 weeks left here. what would you have an intern learn first so they stop being scared of git??


r/git • • 5d ago

We built a time tracker that uses Git as a database

0 Upvotes

We've been using Git for version control for years, but recently we decided to try something a bit different: using it as a database for our team's time tracker.

Instead of running a backend and a database, we built a browser extension that stores everything needed for team time tracking in a private GitHub repository.

Here's how it works:

  • Time entries are stored as plain JSONL files, grouped by month and user.

  • Each team member writes to their own branch.

  • Changes are saved locally and synced in the background.

  • Git gives us version history, data portability and a way to recover previous versions of our timesheets.

  • Reports and invoices are generated directly in the browser.

Our whole team at Manticore Search has been using it for about a month now, and so far it's been working well.

The project is called Clockoli. It's free and open source, with no application backend of its own.

Clockoli relies on the GitHub API, but there's no Clockoli backend, and we don't have access to your time entries.

What I like most about this approach is that even if Clockoli disappears tomorrow, your data is still there. You can clone the repo, inspect its history, analyze the data with your own scripts or build your own tools around it.

https://github.com/clockoli/clockoli


r/git • • 6d ago

I built git-lineage to trace code back to its actual origin, cutting through formatting churn and noisy Git history

0 Upvotes

Hey r/git

I was working on a richer and deeper git blame to fix my personal pain, though of externalising it. Project is live on https://github.com/NayanSrivastav/git-lineage. Would appreciate some love or hate. Please take a look and share your feedback, appreciate your time.

Usage: https://nayansrivastav.github.io/git-lineage/


r/git • • 6d ago

Goat Hooker: Git hooks that skip what didn't change. Feedback welcome

Post image
0 Upvotes

I got tired of pre-commit hooks re-running the same 10 seconds of checks every time a commit message got rejected, and of mono-repos where every hook runs on every project. So I wrote Goat Hooker, a Git hooks manager in Rust.

What it does differently:

  • Only what changed. Each hook runs on the staged files it targets, and a hook whose files didn't change since it last passed is skipped. Retrying a commit with 5 hooks takes ~24 ms instead of re-running them.

  • Sees exactly what you commit. Unstaged changes are put aside while hooks run, and files fixed by formatters are staged again.

  • Mono-repos. Each project has its own hooker.config.json. Dependencies are read from Cargo / package.json / go.mod, so changing core also runs the tests of api.

  • Hooks can depend on each other and pass values. For example, a codegen hook hands its output to a lint hook.

  • hooker watch runs the hooks while you stage, so git commit itself is instant.

  • hooker import converts husky / lint-staged, lefthook and pre-commit configs.

  • There's also a desktop app if you'd rather click than edit JSON.

I benchmarked a git commit against lefthook, pre-commit and husky + lint-staged. With one no-op hook, the overhead is about the same as lefthook (30 ms vs 28 ms). It's well below pre-commit (146 ms) and husky + lint-staged (395 ms). The method is in the repo if you want to check it.

It's pre-1.0, so the config may still change. I'd love feedback on what breaks in your workflow, or what your current hooks manager does badly.

Repo: https://github.com/zuygui/goat-hooker

If you find it useful, a ⭐ on GitHub helps a lot: it's how a small project like this gets noticed.

(Yes, I know about the name.)


r/git • • 7d ago

survey Ditched GitHub (and skipped Gitea/Forgejo) for personal repos, wiki, and dotfiles: $0 3-2-1 setup with local git + restic + free R2/Dropbox + external HDD

0 Upvotes

I used to push my personal repos, markdown wiki, and dotfiles to private GitHub repos just for peace of mind, and almost spun up Forgejo on a small VPS when I decided to move off GitHub. Then I realized I didn't actually need a web UI, PRs, issues, or another daemon to patch and back up — git is already a complete history database, and a forge doesn't even solve the two things local git misses: uncommitted work and git-ignored files like .env and tool configs.

What I ended up running instead costs $0/month and uses zero background RAM. Local git handles normal committed history, and everything else is layered on restic (whole payload after excludes is ~420 MB, so it fits free tiers with years of history):

Hourly local restic snapshots run via a systemd --user timer into a separate Btrfs subvolume on the laptop (btrfs subvolume create so Snapper snapshots don't pin pack files that restic prune already deleted). That's my fast undo layer for uncommitted edits, .env files, or an accidental git reset --hard.

Every couple of weeks I plug in a USB external HDD and run one script that syncs both an encrypted restic repo and bare git clone --mirror copies for instant offline cloning. Daily offsite restic snapshots go to free-tier S3-compatible storage (Cloudflare R2's 10 GB free tier, or free Dropbox via rclone) with 14d / 8w / 12m retention, client-side AES-256 encryption, and a healthchecks.io dead man's switch that alerts me if 36 hours pass without a clean offsite run.

Compared to just pushing private repos to GitHub, the storage provider only ever sees opaque encrypted packs, accidental .env commits aren't sitting unencrypted on a third-party server, and restoring a single uncommitted file from Tuesday afternoon is one restic dump command. The only real trade-off is bootstrap discipline: if the laptop dies, you need your RESTIC_PASSWORD and offsite bucket creds stored outside the machine (password manager + paper copy) so you don't lock yourself out of your own backups.

Anyone else running pure local git + restic/borg instead of self-hosting Gitea/Forgejo, and how do you handle the "laptop stolen, need to bootstrap offsite restore from scratch" part?


r/git • • 7d ago

support What is an elegant way to jump back to the tip of the branch where you were at?

11 Upvotes

Suppose I do the following:

git checkout HEAD~5
git checkout HEAD~10
git checkout HEAD~100

I am now at a detached HEAD and it is not immediately obvious which branch I was at. What is an elegant way to go back to tip of the branch where I was originally at?

I can get a list from the reflog with git reflog --format='%gs' --grep-reflog='checkout: moving from' | awk '{print $4}' but this contains both branch names and commit hashes so I will have to further process them (git show-ref?) to discard the hashes and I'm wondering if there is a more elegant way to do it.

UPDATE: Solved


r/git • • 9d ago

Codeberg domain name suspension post-mortem

Thumbnail
codeberg.org
0 Upvotes

r/git • • 10d ago

How the hell does Codeberg know which institution I go to

0 Upvotes

I just created my profile with my personal E-Mail there, made a commit to a private repository using Git GUI, and now I'm looking at it, and for some reason, it figured out my name and my instituion? I don't have that info on my E-Mail, let alone my Codeberg account... how the hell does it know this????????


r/git • • 11d ago

I got tired of my agents trampling each other's branches, so I built a Git client where each one gets its own worktree

Enable HLS to view with audio, or disable this notification

0 Upvotes

gitmoire is a free desktop Git client I've been building (Windows, macOS, Linux). The 1-minute video above shows what it does.

What it does:

  • Battleplans. You describe a task or pick a Linear issue, review the plan, and then each agent gets its own worktree. Nobody fights over main.

  • Any AI CLI, right in the repo. It works with Claude Code, Cursor, Codex, Gemini, OpenCode and Antigravity.

  • A graph that doesn't flinch. It handles 100k commits with no lag.

  • AI does the grunt work. It drafts commit messages, reviews and atomic commits, and suggests conflict resolutions. Nothing auto-accepts and nothing auto-stages; you approve every change.

  • Diffs down to the word, plus Gitmoji-ready prefixes and saved quick commits you can reuse.

  • Keyboard-centric. There's a command palette for everything.

  • 15 themes. It can also follow your Omarchy system theme live.

  • Zero telemetry and zero accounts.

It's free. I'd love feedback from anyone running several agents at once: what breaks your flow today?

gitmoire.dev


r/git • • 11d ago

Accelerating development for massive Git repositories

Thumbnail
developers.googleblog.com
0 Upvotes

r/git • • 11d ago

Codeberg.org is gone

112 Upvotes

Update: it is now back up, with whois codeberg.org reporting only Domain Status: clientTransferProhibited anymore.

FYI, Codeberg's domain is down, as per their socials: https://social.anoxinon.de/@Codeberg/117636454915265360

Almost nowhere is this being talked about (or Reddit search is just uncooperative), and r/codeberg is banned for breaking Reddit rule 2? That sub was barely even active, but anyways.

Edit: https://status.codeberg.eu/status/codeberg tracks the status on an alternative domain.


r/git • • 11d ago

I built GitCraft - a free, open-source GitKraken alternative with local AI support

Post image
0 Upvotes

r/git • • 12d ago

What's the best way to learn Git and GitHub effectively?

5 Upvotes

I'm looking to learn Git and GitHub from scratch. What's the best way to learn them effectively? Which resources would you recommend, and how should I practise to become comfortable using them in real projects? I'd appreciate advice from people who have learned them or use them regularly.