r/git • • May 27 '25

The last .gitignore you will ever need

Post image
1.9k Upvotes

I have been thinking about how to stop all the csv, xml, txt etc. files from entering the repo and cluttering everything. Some of my coworkers are eager to add every little script and generated file to the repo. I have had enough. Here is my solution. It is to late for me, but maybe it can save you.


r/git • • Feb 20 '26

Has this happened to you

1.8k Upvotes

r/git • • Jul 26 '26 Popcorn

In case of fire

Post image
1.4k Upvotes

r/git • • Nov 11 '25

What's the Craziest Thing You've Seen Committed to a Repository?

Post image
1.3k Upvotes

It blows my mind still how many random artifacts you still see rocking up in repos. Give me your best stories:

  • Sensitives

  • VHDX files

  • 10 minute clones

Not that crazy, but I have seen repos with a bunch of separate Terraform stacks, all with their own .terraform folders full of providers!


r/git • • Oct 19 '25

Why is git only widely used in software engineering?

1.2k Upvotes

I’ve always wondered why version control tools like Git became a standard in software engineering but never really spread to other fields.
Designers, writers, architects even researchers could benefit from versioning their work but they rarely (never ?) use git.
Is it because of the complexity of git, the culture of coding, or something else ?
Curious to hear your thoughts


r/git • • Sep 17 '25

Git tricks we wish we knew 5 years ago

1.1k Upvotes

Working with millions of developers, we keep seeing the same Git pain points. Here are 5 commands that solve the most common issues:

1. git reflog - The Time Machine Accidentally deleted a branch? Reset to the wrong commit? Reflog is your safety net.

git reflog
# Find your lost commit hash
git checkout -b recovery-branch <hash>

2. git bisect - The Bug Hunter When you know something broke but don't know when:

git bisect start
git bisect bad HEAD
git bisect good <known-good-commit>
# Git will guide you to the problematic commit

3. git stash --include-untracked - The Context Switcher Need to switch branches but don't want to commit messy work:

git stash push -u -m "work in progress on feature X"
# Work on other branch
git stash pop

4. git cherry-pick - The Surgical Strike Need just one commit from another branch:

git cherry-pick <commit-hash>
# Or for a range:
git cherry-pick <start-hash>^..<end-hash>

5. git worktree - The Parallel Universe Work on multiple branches simultaneously:

git worktree add ../feature-branch feature-branch
# Now you have two working directories for the same repo

What Git commands did we miss?


r/git • • Oct 29 '25

support Git Commands Cheat Sheet — What should I add or fix?"

Post image
999 Upvotes

r/git • • Apr 06 '26 Bravo

Many of you asked after my previous post (“Git Commands Cheat Sheet — What should I add or fix?”), so here’s an updated & printable version — feedback / PRs welcome

Post image
943 Upvotes

r/git • • Jul 24 '25

What are the chances of this tag hash

Post image
912 Upvotes

I had to do a double take when I saw this hash. God must have been trying to make me laugh.


r/git • • Aug 02 '20

Yes Iam one of them 😅

Post image
739 Upvotes

r/git • • Feb 09 '26

support Is there any way to retrieve it?

Post image
661 Upvotes

I was making a movie recommendations system and had a pkl file which was 100+ mb and I was trying to upload it with the help of chatgpt and it got deleted??


r/git • • Aug 02 '25

I finally ditched git merge for rebase and cherry-pick — and I'm never looking back

575 Upvotes

For years, I relied heavily on git merge and opened pull requests for every little thing. The result? A messy history full of merge commits and clutter that made it hard to follow what actually changed.

Recently I decided to dive deeper into git rebase and git cherry-pick, and it honestly changed everything. Now my history is clean, focused, and linear. No more "Merge branch X into Y" noise.

Instead of opening PRs for quick changes, I just cherry-pick commits across branches or rebase when necessary. It feels more deliberate and keeps the main branch readable.

I know it's not for every team workflow, but for solo projects or small teams, this is 🔥.

Curious — how many of you prefer rebase/cherry-pick over merge/PRs? Any caveats you've run into?


r/git • • Jun 06 '26 Mindblown

The first git commit on git, funny!

Post image
548 Upvotes

Initial revision of "git", the information manager from hell, Lool

Apr 7 2005 ..this README file by Linus Torvalds is really insane


r/git • • May 19 '26

I didn't know git OFFICAL GUI exists too.. but it looks so old

Post image
522 Upvotes

r/git • • Aug 01 '19

Never forget

Post image
441 Upvotes

r/git • • Sep 30 '25

survey Rebase is better then Merge. Agree?

428 Upvotes

I prefer Rebase over Merge. Why?

  1. This avoids local merge commits (your branch and 'origin/branch' have diverged, happens so often!) git pull --rebase

  2. Rebase facilitates linear history when rebasing and merging in fast forward mode.

  3. Rebasing allows your feature branch to incorporate the recent changes from dev thus making CI really work! When rebased onto dev, you can test both newest changes from dev AND your not yet merged feature changes together. You always run tests and CI on your feature branch WITH the latests dev changes.

  4. Rebase allows you rewriting history when you need it (like 5 test commits or misspelled message or jenkins fix or github action fix, you name it). It is easy to experiment with your work, since you can squash, re-phrase and even delete commits.

Once you learn how rebase really works, your life will never be the same 😎

Rebase on shared branches is BAD. Never rebase a shared branch (either main or dev or similar branch shared between developers). If you need to rebase a shared branch, make a copy branch, rebase it and inform others so they pull the right branch and keep working.

What am I missing? Why you use rebase? Why merge?

Cheers!


r/git • • Jul 24 '25

Colleague uses 'git pull --rebase' workflow

396 Upvotes

I've been a dev for 7 years and this is the first time I've seen anyone use 'git pull --rebase'. Is ithis a common strategy that just isn't popular in my company? Is the desired goal simply for a cleaner commit history? Obviously our team should all be using the same strategy of we're working shared branches. I'm just trying to develop a more informed opinion.

If the only benefit is a cleaner and easier to read commit history, I don't see the need. I've worked with some who preached about the need for a clean commit history, but I've never once needed to trapse through commit history to resolve an issue with the code. And I worked on several very large applications that span several teams.

Why would I want to use 'git pull --rebase'?


r/git • • Sep 06 '21

Git explained with cats

Thumbnail
gallery
393 Upvotes

r/git • • Jul 26 '19

GitHub banned all Iranian users. Our accounts are restricted now. Please help us with contributing to this repo and show your support with a pull request. Thanks.

Thumbnail
github.com
390 Upvotes

r/git • • Aug 11 '25

tutorial Git Rebase explained for beginners

383 Upvotes

If git merge feels messy and your history looks like spaghetti, git rebase might be what you need.

In this post, I explain rebase in plain English with:

  • A simple everyday analogy

  • Step-by-step example

  • When to use it (and when NOT to)

Perfect if you’ve been told “just rebase before your PR” but never really understood what’s happening.

https://medium.com/stackademic/git-rebase-explained-like-youre-new-to-git-263c19fa86ec?sk=2f9110eff1239c5053f2f8ae3c5fe21e


r/git • • Oct 27 '25

The 30-second habit that’s saved us hours in debugging later

355 Upvotes

We used to treat commit messages like throwaways: “fix stuff” here, “oops” there.

It was fine… until we had to debug six months later and had no idea what “stuff” was fixed.

Now, our team spends an extra 30 seconds writing clear commit messages that explain what changed and why. Our team can finally follow the story of the codebase without spelunking through diffs.

Want to add even more context? Use Conventional Commits to prefix your commits. They even make generating changelogs and bumping semver easy.

It’s wild how such a small habit changes collaboration speed.

Anyone else have a “tiny Git habit” that completely changed your workflow?


r/git • • Nov 09 '25

Gitlab vs github?

354 Upvotes

My company uses gitlab but it seems everyone outside of my company uses github.

Can someone help explain the difference? Whats truly better?

Edit: thank you all for youre amazing replies


r/git • • Oct 04 '25

How can someone have Git commits from 1998 if Git was created in 2005?

352 Upvotes

I noticed that some GitHub repositories show a commit history starting from the late 1990s — even though Git was released in 2005 and GitHub launched in 2007.

How is that possible? Were those projects using a different version control system before Git and then imported the history, or can commit dates be manually faked somehow?

Curious to know how this works under the hood.


r/git • • Oct 24 '25

Typing practice but it's Git commands

344 Upvotes

Hi!

When I worked at Amazon - I used to work with a few engineers who just knew many git commands / flags off the top of their head, would type them out really quickly too - it just seemed so convenient. To practice that I would do typing practice in various apps and I would use useful git commands as custom text.

Now, since I built typequicker - I added that as a feature! We support code typing practice and include many tools/language - including Git!

(Also I don't type that fast - video is sped up for brevity ;)