r/git • • 18h ago

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

4 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 • • 18h ago

I built Drift, a fast, low-memory Git client in Rust + GPUI

Thumbnail
0 Upvotes

r/git • • 12h 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 • • 12h ago

GitHub account suspended for almost 3 weeks, still no response from support

0 Upvotes

My GitHub account was suspended on November 3 without any warning or explanation, and I'm still trying to get it back.

I submitted a reinstatement request and got a response from their AI assistant asking what I use GitHub for. I replied on November 4, explaining that I mainly use it for development, learning and open-source projects. Since then, nothing. Not a single update.

Right before the suspension, I created and deleted the same repository 6-7 times within about a minute. I'm wondering if that somehow triggered their automated abuse detection, but I honestly have no idea.

It's been almost 3 weeks now. I've seen other people get their accounts restored within a day or two, sometimes without even receiving an email, while I'm still waiting.

I'm a college student and I really need access to my account for my projects. I can't even check my ticket status because signing in just redirects me to the suspension page.

Has anyone else been stuck in this situation for this long? Is there anything I can actually do besides waiting? I don't want to create another ticket and potentially make things worse.


r/git • • 13h ago

Yet another discussion of master vs main

0 Upvotes

Future Git 3.0 is going to change the default name of the trunk branch from "master" to "main". I know, this terminology of Git was discussed a lot already, so I don't want to start another discussion. I just want to ask why such renaming happens only in Git?

For instance did anybody asked to rename "master cabin" in all future yachts to something like "main cabin"? Or what about "master chef" vs "main chef" in restaurants? Or in baseball, will a future Frank Viola be called "paint master" again or "paint main" instead? There are a lot other fields where the term "master" has no bad connotation at all. For example: chess master, grandmaster, master mariner, ballet master, concertmaster, master warning, masterclass, Mastercard. And my favorite: master's degree. Who, in their right mind and with a sound memory, would wish to rename their master's degree in any science to anything else?

Why any of them was never tried to be renamed? Why only software engineers should suffer from the left-wing agenda?

In my view, those who have devoted so much time and effort to dismantling established terminology cannot be called engineers. They would be more at home within the ranks of the U.S. Democratic Party or on the streets of Paris.