this post was submitted on 13 Oct 2024
15 points (100.0% liked)

Git

2903 readers
1 users here now

Git is a free and open source distributed version control system designed to handle everything from small to very large projects with speed and efficiency.

Resources

Rules

  1. Follow programming.dev rules
  2. Be excellent to each other, no hostility towards users for any reason
  3. No spam of tools/companies/advertisements. It’s OK to post your own stuff part of the time, but the primary use of the community should not be self-promotion.

Git Logo by Jason Long is licensed under the Creative Commons Attribution 3.0 Unported License.

founded 1 year ago
MODERATORS
top 5 comments
sorted by: hot top controversial new old
[–] FizzyOrange 11 points 1 month ago

I used to use Git stash but I found in the end I found just making "real" commits was better.

[–] [email protected] 3 points 1 month ago (1 children)

Git stash is terrible if you have anything like ADHD.

[–] [email protected] 3 points 1 month ago

the nightmare of accidentally clearing your git stash having a very large change.

[–] tatterdemalion 2 points 1 month ago
[–] nous 2 points 1 month ago

I no longer use git stash. I found far too many issues with it. Merge conflicts and old no longer useful stashing building up, forgetting what was on it and which branch it came from and other things. These days the only time I stash is with --autostash on a git rebase as that is very temporary.

Instead I have moved to a worktree where I just commit everything on the main branch. Then use a different worktree to create a branch and cherry pick from main and create prs from that branch.

No need to stash as my main worktree never changes off the main branch and my second worktree never has local changes that are not committed.

If I need to change focus or fix a bug I can just do that, commit those changes only and cherry pick to a new branch all without affecting my current work (assuming I have not changed the area the bug is in too much but that is not a big issue if you keep commits small and create PRs often so you don't drift too far from master).

If I have drifted too far I can always create a new worktree from origin and not touch my local main.