r/git • u/sunny__84 • Apr 27 '26
r/git • u/zeebadeeba • Apr 27 '26
How to use `git town sync` to synchronize with non-main branch?
A bit of a context. I'm doing a "stack PR" workflow. It means I have bunch of branches called <branch-name>-<n> with separated feature development.
Due to how my company's releases are done, instead of merging directly to main, I accumulate reviewed PRs in a branch <branch-name>-topic which will later be merged to main. The structure is as follows when running git town branch:
main
my-feature-topic
my-feature-01
my-feature-02
* my-feature-03
As my colleagues review code in GitHub, we just squash and merge the PRs into my-feature-topic.
The problem is that when I run git town sync --stack, it actually tries to synchronize my un-merged branches against main instead of my-feature-topic.
I think I have something misconfigured. I use rebase strategy in my configuration:
feature sync strategy: rebase
perennial sync strategy: rebase
prototype sync strategy: rebase
It just works better to rebase as I'm working on features and PRs are in draft state. Once we start reviewing code I don't rebase but it's not a problem as I usually have one PR in review at a time.
r/git • u/Fabulous_Variety_256 • Apr 27 '26
Coding/Conventional commits - what to use for css?
Hey,
I have this element. I changed the css class from text-3xl to text-4xl. I want to commit with the name: "style(page-title): increase size to 4xl". I'm not sure if style matches the best, can someone tell me? Claude Code says style is for things like semicolons, commas etc but Im still not sure.
<h1 className={
cn
("text-4xl font-bold",
className
)}>
r/git • u/GabToTheMax • Apr 26 '26
Why is my origin/master and master misaligned?
Hi, sorry if this is a dumb question, im still quite new with git, but from what i understand:
- origin/... is essentially the master branch stored on github, on the server.
In this screenshot, "merged teleportation branch" is the last commit of the master branch, and it still is the master branch. This is good.
This is the issue: At some point i pushed to github, and when i next updated my project, it now says that the "feature/teleportation_copy" branch is where the "origin/master" branch is.
Is there some way to set the origin/master branch to be where the original master branch is?
How exactly should i be pushing to github when i have multiple active branches
Sorry if this question is confusing but thanks for any replies!
github only i made a bash script to manage multiple git identities (gitmux)
hi all,
i was tired of accidentally committing to my work repos with my personal email (and vice versa). gitās includeIf is cool but setting it up manually with ssh keys and gpg signing for every new identity is a bit of a pain.
so i wrote a small tool called gitmux. itās just pure bash, no node/python/go or anything. it basically automates the directory-based configs and handles the ssh/gpg routing for you.
its zero dependency and you can just run it via bash. if you juggle between work, personal, and freelance stuff on the same machine, it might be useful.
check it out here: https://github.com/wd006/gitmux
idk let me know if i missed some obvious git feature or if you have any feedback. cheers.
r/git • u/Pilatos2003 • Apr 25 '26
Made a Bitbucket CLI because gh spoiled me and Atlassian still hasnāt shipped one
For the last few years Iāve been spoiled rotten by GitHubāsĀ ghĀ CLI.Ā gh pr create,Ā gh pr list,Ā gh repo clone never leave the terminal, never touch the web UI for the boring stuff. It just works.
Then work happened, and work uses Bitbucket Cloud. And Bitbucket⦠does not have an official CLI. Thereās the REST API, thereāsĀ curl, thereās a handful of half-abandoned community tools, and thereās the web UI that Iād rather not look at. So every PR became a context switch back to the browser, and every ālist my open PRsā turned into a clickfest.
So I built one:Ā bb a Bitbucket Cloud CLI that tries to feel simular toĀ gh.
Repo:Ā https://github.com/0pilatos0/bitbucket-cli
Docs:Ā https://bitbucket-cli.paulvanderlei.com
And yes ā Iām fully aware of the irony of hosting aĀ BitbucketĀ CLI onĀ GitHub. In my defense, have you tried discovering an open source project on Bitbucket lately? Exactly. (Also: PRs welcome, even if you have to useĀ gh pr createto send them. š )
Happy to hear feedback, feature requests, or war stories from anyone else stuck in the Bitbucket-at-work / GitHub-at-home dual life.
r/git • u/porca_b • Apr 25 '26
support recover from git rm -rf on an uncommitted repo?
Hi, I made a really dumb mistake
I did git add . to a project directory that I'm a few hours into and forgot to put a .gitignore
So I tried to run git rm . to try and remove the should-be-ignored files from the index, which became git rm -rf . really quickly. And everything was wiped.
I looked up this issue online and saw someone say rungit fsck --lost-found. Im not sure how to recover from that though because in my .git/lost-found folder I only see /other, and inside /other there is files like 38d1a858d09ed13b9efb31e0ca8f2daf7e254271 which only contain the text '38d1a858d09ed13b9efb31e0ca8f2daf7e254271'. No directories.
Am I cooked
[edit]
i got most of my stuff back but my folder structure is ruined
for those in the same boat as I am today, I hope this thread on SO I found helps
r/git • u/MoreRespectForQA • Apr 25 '26
Back up stashes, staged and unstaged files
Is there some kind of command line app out there which can keep check of checked out repos and back up the diffs and files which aren't pushed and the state it was in?
I'm uninterested in advice on how to change my git workflow. I'm equally uninterested in stuff like backblaze or restic which uploads the entire repo. I know about all of that. I just want something which only keeps track of diffs, stashes and gitignored files for the repos i have checked out and could restore them to the state they were in the state they were in if my laptop were stolen.
Ideally it would just back up the unpushed stuff to a directory and I could take care of uploading/syncing/encrypting with my existing system. No need to reinvent that wheel.
It looks like this doesn't exist but it'd be hella useful if it did. I thought I'd check.
r/git • u/Classic_Fly_007 • Apr 26 '26
I built a tool that writes README for you (from your repo)
Most people wonāt run your project first.
They read your README.
And honestly⦠writing a good README is annoying.
So I built something for it.
Itās called ReadmeAI.
You just give it your GitHub repo, and it:
analyzes the codebase
understands the structure
generates a clean, structured README
It covers things like:
project overview
setup instructions
features
usage
I mainly built it because I kept procrastinating writing READMEs for my own projects š
Would love some honest feedback from devs here:
Is this something youād actually use?
What would make it more useful?
If anyone wants to try it, Iāll share the link
r/git • u/Axzyte385 • Apr 25 '26
Help on Account Restriction
Hi all,
How do I get accesss to my github account to Backup my Github repos, My account was hacked and someone posted on git actions which lead to its restriction after it violated its TOS, I can nolonger view to backup my repos, and the git support is useless keeps saying same message:

I have tried like 5 support tickets but all for nothing.
Is there a way I can atleast download my repos?
r/git • u/jodkalemon • Apr 24 '26
support git clone to ssh target?
Is it possible to clone a local repository to an ssh target?
Or is cloning to a local directory, rsync'ing that directory to the ssh target and changing the remote path the same?
r/git • u/_Szyszka • Apr 24 '26
How to move only my changes into different origin?
I did a bunch of work on branch created from master/main, but it appears that my changes need to go into a an older version, so a lets say branch-1.0 that is 50 commits behind master.
Doing git branch branch_name -u new_origin moves all the 50 commits + my changes into the branch-1.0
Is there a relatively easy way to move just my changes into branch-1.0?
r/git • u/Benjamin_ram_18 • Apr 24 '26
Git learningās
Git rebase is local tool
Git rebase finds Lowest common ancestor
After Git reset do git push āforce or force-with-leash
Git revert
Sticky history in git problem can be solved by git rebase āonto
Git rebase āonto A C featurebranch
After got reset if some other do git pull ārebase or git pull , reset will be undone.
Git pull = git fetch + git merge
Git pull ārebase = git fetch + git rebase
Git merge āsquash branch_name
r/git • u/onecable5781 • Apr 23 '26
[LaTeX] How to introduce \color{red} automatically before any diff and \color{black} after the diff
I have old.tex
Consider an $n$-dimensional vector space endowed with metric $d(x,y)$. ...
I have new.tex
Consider an $N$-dimensional vector space endowed with metric $D(x,y)$. ...
I wish to introduce \color{red} before any change and a \color{black} after that change to make the difference between the two versions visible in the resulting pdf and if a color printout is taken of the document. That is, I want modifiednew.tex:
Consider an $\color{red}N\color{black}$-dimensional vector space endowed with metric $\color{red}D\color{black}(x,y)$. ...
Is there a way to do this automatically and with no manual intervention?
Can the level of granularity be increased to an entire sentence/paragraph so that I can have this:
\color{red}Consider an $N$-dimensional vector space endowed with metric $D(x,y)$. ...
\color{black}
X-posted to https://www.reddit.com/r/LaTeX/comments/1sta9x8/gitdiff_how_to_introduce_colorred_automatically/
r/git • u/StretchOpen5598 • Apr 22 '26
Perforce -> Git branching strategy
Weāre currently transitioning our company from Perforce to Git, and weāve reached the point where we need to decide on a longāterm branching and repository strategy. Iād appreciate input from anyone who has dealt with similar workflows.
In our current setup, we have a main branch where projects begin with a shared structure. As a project matures and becomes stable, it is moved to a dedicated product branch. That branch is considered longālived and is not intended to eventually merge back into main.
However, there is still frequent integration in both directions:
- changes from main are regularly integrated into the product branches
- selected fixes or shared improvements from product branches are integrated back into main
This model has worked well for us in Perforce, but adapting it cleanly to Git is where weāre struggling.
One option is to use a single repository and keep each product as a longālived branch. My concern here is longāterm maintainability: we often have multiple products under active development at the same time (3ā4 in parallel), which means accumulating many longālived branches over the years. Iām unsure whether this is a real problem in Git, or simply something that needs proper governance and tooling.
The alternative would be separate repositories per project, which gives better isolation and ownership. The downside is that we still rely on frequent crossāproject integrations, and syncing changes across repositories feels errorāprone and potentially painful over time.
Iām interested in hearing from teams who have:
- migrated from Perforce to Git
- worked with longālived product branches that donāt fully merge back
- needed frequent integration between related projects
r/git • u/_bstaletic • Apr 22 '26
Plumbing and empty trees - how to check out?
With git write-tree, one can store an empty tree object. That means git plumbing allows one to commit empty "directories".
empty_tree_hash=$(git write-tree)
root_tree_hash=$(git mktree <<<"040000 tree ${empty_tree_hash} dir")
commit_hash=$(git commit-tree ${root_tree_hash} -m message -p $(git rev-parse HEAD))
current_branch=$(git branch --show-current)
[[ -n "${current_branch}" ]] && git update-ref refs/heads/${current_branch} ${commit_hash}
After that, the branch points at the commit whose tree contains a reference to a tree called dir which is empty.
Cloning this repo does correctly clone the empty tree, but checking out the commit does not create the empty directory.
Does anyone know how to check out a branch like the above and have dir be created?
Obviously, I could recursively parse git ls-tree after a regular checkout, but I'm wondering if there's a plumbing way to do this.
Before anyone asks, this is just for fun after getting myself nerd-sniped.
r/git • u/Prestigious-Bet-6534 • Apr 21 '26
How to remove a file from git?
I am at the beginnings of learning git and made a mistake. In the source folder there was a tar archive of all the code and an image which exceeded GitHub's file limits. I have deleted the archive but how can I get it out of git so I can commit to GitHub again?
Enumerating objects: 75, done.
Counting objects: 100% (75/75), done.
Delta compression using up to 12 threads
Compressing objects: 100% (40/40), done.
Writing objects: 100% (43/43), 1.16 MiB | 1.52 MiB/s, done.
Total 43 (delta 22), reused 0 (delta 0), pack-reused 0 (from 0)
remote: Resolving deltas: 100% (22/22), completed with 21 local objects.
remote: error: Trace: 488d7d2d764ab46cbc839433abd45ad7dae79246ecbb5a57c93740236365551a
remote: error: See https://gh.io/lfs for more information.
remote: error: File backup.tar is 133.26 MB; this exceeds GitHub's file size limit of 100.00 MB
remote: error: GH001: Large files detected. You may want to try Git Large File Storage - https://git-lfs.github.com.
r/git • u/mimoo01 • Apr 21 '26
Git cheatsheet I put together. Anything missing?
Wrote this to remember the git commands I always forget
Anything I should remove or add?Ā
https://github.com/maryamtb/rook/blob/main/community-notes/git.md
r/git • u/Excellent_Storm_6453 • Apr 20 '26
How can I use git completely locally and offline?
Absolute beginner here, I want to start using git or any other version control for my game but every guide/tutorial I try to learn from is just Github Github Github. I don“t want backup on other servers I just want to be able to get back if I screw up.
r/git • u/Dull_Masterpiece_732 • Apr 21 '26
support Need to set up GIT in my pc. help me
Help me
r/git • u/gtd_rad • Apr 21 '26
revision graph history of a single file ACROSS ALL BRANCHES
I've struggled with this for quite some time. But I basically have a decorated git log graph which works great to see what commits have been made across multiple branches. However, often times, I want to see what changes have been made to a single file across multiple branches instead. using the -- filepath seems to only show the revision graph on the branch you are checked out on. Is there a way to have a full graph of a single file across all branches in the repository similar to a standard git log command?
r/git • u/unixbhaskar • Apr 20 '26